Skip to content
SLIME-like support for running Vim with iTerm2
VimL AppleScript
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


SLIME-like support for running vim with iTerm2

What is it?

For the video-inclined watch it here.

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


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


At the moment rather than support all the possible testing methods I have <leader>ft try to run script/test against the current file and <leader>fT pass the current file as path:line_number. I'll include a contrib directory with various testing tools in the near future but for now a simple script/test for Rails would be:

ruby -Itest "$@"

Of course this wouldn't support focused unit testing. More on that to come soon.

If you're using rspec, focused testing works just fine, like so:

rspec "$@"


For any commands

  • ISlime2 echo hi mom - runs "echo hi mom"
  • <leader>ff - re-runs the last run command
  • <leader>fp - equivalent to hitting up then enter in the terminal

For testing

  • <leader>ft - runs script/test path/to/current/file
  • <leader>fT - runs script/test path/to/current/file:line_number


  • <leader>cc - sends the current paragraph (using vip) or selection to the terminal
  • <leader>cf - sends the whole file to the terminal

Other helpers

  • <leader>fr - runs rake
  • <leader>fd - runs script/deliver which I use to merge to master and deploy to staging


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


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


Something went wrong with that request. Please try again.