Polycephalous Plugins

Working in a modern command-line environment can offer several ways to manage multiple windows: Vim itself supports split windows and tabs, and many Vim users also use terminal multiplexers like tmux and GNU screen. However, there are those of us who also use a terminal that supports split windows and tabs, like iTerm2.

A new breed of Vim plugins can take advantage of all of these features to better support asynchronous tasks. For example, dispatch.vim by Tim Pope is a new one that can talk to tmux, screen, and iTerm to run time-consuming tasks in the background using Vim's standard compiler plugins. The intention is that you can asynchronously run test suites while continuing to work.

There's also Vitality by Steve Losh which enables Vim to communicate with iTerm2 and tmux.

Another approach is to use terminals as the recipients of piped commands, which might suit a REPL-like workflow. One popular plugin that does this is tube.vim by Giacomo Comitti.

These plugins aren't just handy for running tests, but anything that might interrupt your workflow. Searching, even with fast tools like ack, can be relatively slow, so if you search a lot you could try one of these tools.

In case you were wondering, communicating with iTerm2 requires AppleScript, so the behaviour isn't portable. To support other platforms, dispatch.vim is designed in a modular fashion: each supported terminal type is an "adapter," allowing platform-specific behaviour.

blog comments powered by Disqus