GitXplorerGitXplorer
m

vim-islime2

public
13 stars
6 forks
3 issues

Commits

List of commits on branch master.
Unverified
ceed493ecf7fbf10cb515c0ecf2bcb4515f6adfb

Include <leader>cc in other mappings documentation

mmatschaffer committed 8 years ago
Unverified
eea417fe8b485822b51c6413462500bd158e6640

Merge pull request #8 from ddrscott/master

mmatschaffer committed 8 years ago
Unverified
88fe75f8855a7471c3e5f908171661477b431aa8

Replace video with demo gif

committed 8 years ago
Unverified
6f3403a51a0f36b3a2f3355f7531c43d72a7df83

Use autoload and remove mappings

committed 8 years ago
Unverified
bd7546a31f6bc950887b2df5ac3f640d1c1ffb2d

A note about 2.9 support

mmatschaffer committed 9 years ago
Unverified
79a2b1893c6b202d660494d2a4e78b9a42514dbb

Merge pull request #5 from matschaffer/nightly-updates

mmatschaffer committed 9 years ago

README

The README file for this repository.

iSlime2.vim

SLIME-like support for running vim with iTerm2

What is it?

It lets you send commands from Vim to an iTerm2 session. This is handy if you need to run a command repeatedly (like a test) and want to see the output. This is especially nice in text-mode Vim, but it works fine from MacVim's GUI too.

It works by using AppleScript to switch to the next iTerm2 Pane (using Cmd+]), writing the appropriate text then switching back (using Cmd+[).

Installation

Include with Vundle, Pathogen or drop the project files into your ~/.vim directory. I use and test this with Vundle.

If you're using this on iTerm 2.9 or above (nightly as of 2015/09/17), you'll also want to set "29" mode since the AppleScript interface has changed a bit. Use a command like so in your vimrc:

let g:islime2_29_mode=1

Usage

For any commands

  • ISlime2 echo hi mom - runs "echo hi mom"

Recommended Mappings

let g:islime2_29_mode=1

" Send current line
nnoremap <silent> <Leader>i<CR> :ISlime2CurrentLine<CR>

" Move to next line then send it
nnoremap <silent> <Leader>ij :ISlime2NextLine<CR>

" Move to previous line then send it
nnoremap <silent> <Leader>ik :ISlime2PreviousLine<CR>

" Send in/around text object - operation pending
nnoremap <silent> <Leader>i :set opfunc=islime2#iTermSendOperator<CR>g@

" Send visual selection
vnoremap <silent> <Leader>i :<C-u>call islime2#iTermSendOperator(visualmode(), 1)<CR>

More Example Mappings

" Send the whole file
nnoremap <leader>cf :%y r<cr>:call islime2#iTermSendNext(@r)<CR>

" Send current section similar to a typical slime C-c, C-c
inoremap <leader>cc <Esc>vip:<C-u>call islime2#iTermSendOperator(visualmode(), 1)<CR>
vnoremap <leader>cc :<C-u>call islime2#iTermSendOperator(visualmode(), 1)<CR>
nnoremap <leader>cc vip:<C-u>call islime2#iTermSendOperator(visualmode(), 1)<CR>

" Rerun the previous iSlime2 command
nnoremap <leader>ff :call islime2#iTermRerun()<CR>

" Send up and enter to re-run the previous command from shell history
nnoremap <leader>fp :call islime2#iTermSendUpEnter()<CR>

" Run rake
nnoremap <leader>fr :call islime2#iTermSendNext("rake")<CR>

" Run a test script on the current file (assumes ./script/test)
nnoremap <leader>ft :call islime2#iTermRunTest(expand("%"))<CR>
remap <leader>ft :call islime2#iTermRunTest(expand("%"))<CR>")

" Run a test script on the current file and line
nnoremap <leader>fT :call islime2#iTermRunTest(expand("%") . ":" . line("."))<CR>

Contributions

Are welcome! Pull request to your heart's content. I'd love to turn this into a general purpose development tool.

License

Copyright © Mat Schaffer. Distributed under the same terms as Vim itself. See :help license.

Thanks