A text editor is the programmer’s lathe, but unlike traditional engineering we can have limitless tools. The question is: how much time do you have to learn about them all?

I’ve used vim a lot over the years, mainly because I spent a long time using Linux and it was there so I used it. The choice was obvious: vim or vi were on almost every machine I had access to, and worked excellently both locally and remotely. Once I’d learnt the basics I was set, I knew enough to get my work done.
Then I found TextMate for Mac OS. The immediacy of TextMate made it easy to get started with, and it has many excellent features. The problem is, I’m not always using a Mac. But you know who’ll follow me around to every platform I use? Good old vim! So I started thinking, how could I make vim feel more like TextMate?
Like many programs on Macs, TextMate has a handy drawer that slides out. This shows the files in your project. It also has tabs for open files, a great “find in project” that works with regexes, find as you type, code completion, columnar editing and bundles.
These features translate to vim through plugins, settings, and a few moments in :help. To see these features in vim, view my screencast.
Project
The Project plugin is great, and works nicely with the mouse if you’re using gvim. The idea is simple: recursively list files in a directory. Searching for a file is easy, because you use the Project buffer like any other vim file, just type / to search. Type \C to create a new project. This will recursively find files for a specific directory. Type \R to refresh, this is handy when you add or rename files. Type \G to grep all the files in the project.
This gives us a big chunk of those TextMate features mentioned above. There’s a problem with this: any informatin architect will tell you it’s important not to let the user feel lost. When you’re using Project, you feel lost regularly, and using vim’s standard buffer management commands becomes pretty painful. To solve this problem, we need something like TextMate’s tabs…
MiniBufExplorer
MiniBufExplorer will provide something very similar to TextMate’s tabs: a small window is created that lists all the open files. You can see which files are unsaved and remove files by moving the cursor over them and pressing d.
MiniBufExplorer and Project work well together, even if you’re not using a GUI. Just make sure you’re familiar with the window keyboard shortcuts!
Code completion, find as you type
The basic completion vim has available is very useful. It matches text based on text it’s seen before, and you press ctrl-p to do this. In gvim7, the matches actually popup over the text so you can see them all quickly.
Vim also allows find as you type: add set incsearch to your vimrc.
Columnar editing
This takes a bit of getting used to, but it works. To work with columns, press ctrl-v. This puts you in visual-block mode. You can read the help on visual-block by typing :help visual-block if all this means nothing to you.
To select a column to type new text into, use ctrl-v and make a selection. Then press I (that’s capital i), then type your text. Press escape once you’re done, and the text will appear on each line!
SVN integration
I made another quick video illustrating integration with version control systems. There’s a bit of a delay as it fetches my SVN info over SSH, but with a bit of customisation vcscommand.vim saves a lot of time.
Conclusions
Hopefully these features and plugins will encourage a few people to take the time to learn vim. And, view my screencast to see these features in action.
Updates
Since I wrote this article I’ve had a few suggestions and tips sent through. Rein Henrichs mentioned that Vim 7 supports tabs, try :h tabnew. And using :e with wildcards allows you to edit any file under the current directory with tab completion. Rein also pointed out that rails.vim can be very useful.





Mayur
Apr 17
You rock!!
Rick
May 29
Thanks for this blog entry. Please keep it updated as you find new things. I just purchased TextMate, but I think I'm going back to MacVim. I want to be proficient on an editor that can be found on all distros (well I shouldn't say "all" - I don't care about windows anymore but am on Linux distros quite frequently). Actually I still find vim's shortcuts due to modal mode a bit better than TextMates. TextMate is more like emacs - my fingers don't work well remembering which combo of keys to use.
Renato
Sep 12
Well, you can have gVim in windows, too (I sure do). Not only the windows version works just normal, but there's a PortableApps version you can carry around in an USB drive (or use on a machine where you don't have rights to install stuff).
alex
Sep 13
I'll have to set up a USB key with PortableApps/gvim, that'll be a life-saver the next time I'm stuck on a Windows machine far away somewhere
Adam Monsen
Sep 26
Very cool, thanks! Script 2086 on vim.org is pretty awesome for emulating TextMate's "snippets" feature.
Szymon
Feb 15
Check out FuzzyFinder with TextMate CMD-T emulation:
http://weblog.jamisbuck.org/2009/1/28/the-future-of-fuzzyfinder-textmate
Marius Andersen
Feb 21
I can't access the screencast.
alex
Feb 21
My web host for that content has messed up my site, I'll get them to fix it
Marius Andersen
Mar 28
Very nice.
I see you use folds in the Project buffer. Is there a way to get Vim to remember these folds next time you start it?
alex
Mar 28
I'm not sure, it's possible you could add something to vimrc that would use the project plugin's API.
I've also found this Project plugin to work well:
http://www.vim.org/scripts/script.php?script_id=1658
Sérgio Luiz Araújo Silva
May 12
Hi, I am brazilian fã vim sending tips for vim lovers :)
sniptmate bether snippetsEmu
http://www.vim.org/scripts/script.php?script_id=2540
This snippets are like TexMate syntax, more easy than snippetsEmu
# trigger "php"
ssnippet php
<?php
${1}
?>
SnipMate on vimeo: http://vimeo.com/3535418
FindMate from Workshop vim in Barcelona:
Find files quickly using find
http://snipt.net/voyeg3r/findmate-plugin-for-vim
http://www.scribd.com/doc/3269047/vim-workshop