Start async task for iterm2 in vim
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
autoload
doc
plugin
Readme.md

Readme.md

Vim-iterm2-start

Dispatch a task for iTerm2 in MacVim, used for async command line task (eg: git push and unite tests)

It works much like vim-dispatch, the difference is it's works (only) with MacVim, iTerm2 latest and fish shell, in order to keep it quite simple. The reason I made this is I found changing the code of vim-dispatch is quite hard, and it doesn't support iTerm2 > 2.9

Requirement:

  • MacVim 7.3+
  • iTerm2 > 2.9 currently in beta test (latest lightly build is preferred)
  • fish shell (otherwise you will need change the code)
  • Knowledge of command line tools

Update

  • notification enabled, looks like:

screen shot 2016-01-07 at 6 17 41 am

Command

  • ItermStart[!] [options] {command}

    Start task in current session of iTerm2, when prefix with !, not foucs the iTerm window

    • -dir=... run command in given directory
    • -title=... set label for iTerm2
    • -no-wait disable the default prompt of press enter to continue on command error
  • ItermStartTab[!] [options] {command}

    Start task in a new tab session of iTerm2, options are the same as ItermStart command

    NOTE: iTerm2 version > Build 2.9.20160103-nightly is required to make iTerm2 run job at background corrently

Global varialbes

  • g:iterm_start_profile is used for control the profile used by ItermStartTab, you can crate a profile of iTerm2 called fish that use fish shell, and config ItermStartTab to use fish shell by add:

    let g:iterm_start_profile = 'fish'

    in your .vimrc

  • let g:iterm_start_enable=1 would enable Mac notification on command success. support growl and terminal-notifier

Intergration

If you use vim-test, you can make your test run in background by adding below lines to your .vimrc:

function! StartTest(cmd)
  execute 'ItermStartTab! ' . a:cmd
endfunction

let g:test#custom_strategies = {'start': function('StartTest')}
let g:test#strategy = 'start'

Send message back to MacVim

You can make use of the vim feature clientserver to send message back to your MacVim, here is a example of creating a filter program that parse output of mocha and fill the quickfix of MacVim

https://gist.github.com/chemzqm/fd1313206c182884efbc

So you can jump to error location directly in your MacVim.

License

MIT