How to get TextMate’s best features in Vim
And code more efficiently to boot
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.
TComment: 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.
7 comments
Leave a comment

Skatt commented:
I’m considering change from Textmate to VIM (web dev) but your arguments are insufficient.
Command-T and Snipmate are very limited, I don’t know NERDTree too much.
SuperTab: I love auto-complete in Textmate with ESC, if you want a list also have ALT+ESC.
TComment: In Textmate ⌘+/
VIM Surround is great.
I did not know Vim Indent Guides but looks nice.
The only thing I love in VIM is running it on server side with SSH, the list of things in Textmate is much longer.
Josh Mock commented:
I didn’t know about ⌘+/. Nice one, Skatt! Proof I was no TextMate power user. It seems to format spacing wrong when toggling comments on and off though, unlike TComment. Also, SuperTab does show the list of auto-complete options, which is definitely important. And I highly recommend learning NERDTree, especially with the leader key hack I mentioned. Navigating through the file list with the “j” and “k” keys is awesome.
I’m curious what you find limited with Command-T and Snipmate. Like I said, I was no TextMate power user, but both seem as powerful as the ‘Mate alternatives for how I use them. I think with Command-T I had to add a line to my .vimrc to make it pull a file list from the proper context, but that was it.
Aside from the features, I love never having to use the mouse or arrow keys to get around. It saves so much time. Once all the keystrokes to do what I could do in TextMate were committed to muscle memory, there was no going back. Every time I open TextMate now, I end up accidentally typing a bunch of “j” and “k” characters when I’m trying to navigate lines!
Now I’m curious: what other things about TextMate would you miss?
Matt commented:
The biggest thing that made me change from textmate to vim was split panes. Also, large text viewing/editing.
Paul commented:
Not to get all magic unicorn babies eating popsicles on you guys, but I think VIM is the closest existing thing to actually interacting with your computer in a meaningful way and has influenced all of my interaction habits since I adopted it. I feel as though I’m actually communicating with my environment as opposed to just poking it with an arrow pointed stick (ie mouse). That coupled with the aforementioned perks in the post and a stellar community makes for what has been, imho, a great experience. I should really probably get out more …
Seriously, though, give it a try … it looks deceptively boring.
Josh Mock commented:
Well said, Paul. Vim is both deceptively boring and has had a major impact on how I interact with my computer, to the point that I sometimes copy text out of other editors (or text areas in my browser), edit in Vim, then copy back over. MacVim’s “New MacVim Buffer with Selection” context option comes in handy there.
Phil Brass commented:
I love me some NERDTree and split panes and ctrl+w,w. Also, I love the fact that I can turn on mouse support in console VIM, and it works over SSH through PuTTY. You can resize panes, use the mouse to make visual selections, etc. You just have to remember to use shift+mouse to send mouse input to PuTTY instead of VIM.
set ttymouse=xterm2
set mouse=a
Ethan Brown commented:
I’ve been a vi man since my university days, when all the talented CS students were split into vi and Emacs camps. I still respect Emacs, but vi’s modal system just makes so much *sense* to me.
In the Windows/.NET world, vi is a little tougher. As loathe as I am to admit it, Visual Studio offers a pretty good IDE, but the drop-in vi editor replacements leave something to be desired so I’ve mostly been going without of my favorite editor for day-to-day coding tasks, which is something I hope to fix soon.
On a humorous note, you can read about my experiences with a company that asked me what my favorite editor was:
http://ethan2011.livejournal.com/1472.html
On a UNIX machine (including OSX), vi rules the roost, in my opinion. In the Windows world, it’s got a ways to go, sadly.
Long live vi!