The debate over the best coding text editor will never end. In our office, the two biggest camps belong to TextMate and Vim. (We have one Komodo user, but we leave him alone.) There are things I love about both editors, but Vim’s modal, mouse-free, keystroke-efficient philosophy eventually won. At first I thought I was sacrificing my favorite TextMate features by choosing Vim, but Vim’s scriptability in the hands of its clever community provided solutions for everything I missed, plus countless other bonuses.
Below is a list of awesome Vim plugins I now depend on daily. Several are unapologetic TextMate knockoffs done in a more Vim-like way. Others are solutions to other coding annoyances that only Vim could do. Try out a few below and see if Vim doesn’t steal your heart. (Also, if you’re new to Vim, I suggest installing Pathogen first to prevent headaches.)
Replace TextMate with Vim
NERDTree: Load a directory tree on the left side of the screen. It will open highlighted files on the current screen or in a new tab. (Pro tip: use the leader key to map some keystrokes to avoid having to type
:NERDTree /path/to/my/code/ every time.)
Command-T: For addicts of TextMate’s ⌘-T smart-filtering file launcher, this plugin recreates that functionality using the leader key.
Snipmate: TextMate lovers can’t live without snippets, so why should Vim fans have to? In a few keystrokes, generate HTML stubs, Python functions and other repetitive, often-used bits of code. It’s stocked with snippet libraries for many languages, and adding your own is easy.
Make Vim do things TextMate can’t
SuperTab: In insert mode, the Tab key will cycle through a list of words to auto-complete what you’re typing.
gcc will toggle comments for the current line of code in normal mode. In visual mode,
gc toggles comments for any highlighted rows. It works in most common programming languages.
VIM Surround: A few keystrokes will add, change or remove brackets, quotes and HTML tags around the current word, line or highlighted text. It takes some time to get the hang of this one, but it is flexible and powerful.
Vim Indent Guides: Trace tab indentations in your code. Very useful for long nested
if/else statements and loops, making sure you close HTML tags and for reading lengthy chunks of indented code.
Jellybeans: Jellybeans is a dark color scheme that’s easy on the eyes. Put it in your
~/.vim/colors/ directory (or
$HOME/vimfiles/colors in Windows) and run
:colorscheme jellybeans or put
colorscheme jellybeans in your .vimrc.
Of course, these plugins only scratch the surface of what Vim can do. If you want TextMate’s code collapsing, Vim can do that. If you want to compile or run code you just wrote, no problem. If you are a Pythonista who lives by PEP 8 formatting, there’s a plugin (and a .vimrc hack) for that. Point being: TextMate is great, but with a little poking around, Vim can do as much or more, often with half the keystrokes.