Humble copy of Sublime SendText
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

VIM Send Text

SendText-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+[).


For any commands

  • :SendText echo hi mom - runs "echo hi mom"

Recommended Mappings

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

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

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

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

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