zerosum dirt(nap)

evolution through a series of accidents

zerosum dirt(nap)

Why I Love Vim

December 06, 2008 @ 08:08 PM by nap · 9 comments

Back when I was a Java developer, I knew and really liked me some IntelliJ. Later, when I moved over to Ruby full time, NetBeans seemed like a damn good choice. After all, I was used to having a “proper” IDE, it had pretty nice Ruby support and also, much to my joy, it had a Vim plugin, which allowed me to use my favorite editor from my pre-IntelliJ days. Win.

Fast forward to about six months ago when I decided that I’d ceased to care about heavyweight IDEs. I just didn’t use enough of their features to make their overall (often cumbersome) weight and memory footprint worthwhile. So goodbye NetBeans with Vim plugin and hello Vim. MacVim, specifically.

Why Vim? Because Vim is universal. Because Vim is love.

Dave Thomas and Andy Hunt famously wrote “Choose an editor, know it thoroughly, and use it for all editing tasks” in their seminal masterpiece, The Pragmatic Programmer. I couldn’t agree more. There is no tool in a programmer’s toolbox more important than an editor, and the importance of knowing it inside and out cannot be understated. For me, ever since college, that editor has always been Vim. It was just everywhere that I needed it to be. It was ubiquitous. I could use Vim at home on my desktop, at school, at work in the campus NOC, at the CS lab, and in any number of remote shell sessions, on even the most obscure platforms. One ring to rule them all.

Vim is also small, and quick. Once you know what you’re doing, it’s quicker and easier to manipulate text in Vim than any other editor that I’m aware of. Of course, the learning curve is steep, relative to other editors. But it’s worth it. When I’m writing code, switching between files, replacing text, et al, I don’t want to have to use the mouse too frequently. Vim, in all of it’s keyboard-centric glory, delivers. MacVim also provides awesome mouse highlighting and menu option support, for the best of both worlds.

There’s also massive value in Vim’s powerful plugins system. Without some of these awesome third party extensions folks have developed for Vim, it wouldn’t be nearly as appealing as a desktop code editor. But by adding plugins like NERDTree, rails.vim, vcscommand.vim, and FuzzyFinder, it becomes a full-fledged programmers editor for me, something that easily outguns TextMate, NetBeans, Komodo, and all the other would-be competitors. Customize it to your hearts content.

Anyway, I just wanted to put that out there. Vim rules. And Tim Pope, author of rails.vim, rules too (even though he looks awful in drag). His plugin, along with NERDTree, vastly simplifies my day to day editing tasks, and reproduces all the functionality I would have actually used from a more fully-featured IDE. Thanks guys. You’re my heroes.

For more information on using Vim as a Ruby developer, see Jamis Buck’s post from a few months back about switching back to Vim from TextMate. It’s a well-written argument, but the really amazing thing about the article is the number of comments it generated. It’s great to see so much love for such a great editor and I’m glad to be in such good company.

So, what’s your favorite go-to editor? If it’s Vim, I’d be curious to know what plugins you’re using and how you’ve customized it.

PS If you’re also a MacVim user, make sure you install the :Bclose script too!

9 comments so far ↓

  • Adam Bair // December 06, 2008 @ 10:11 PM

    Nice writeup! I started out in Vim, then went to TextMate for a few years and now I'm coming home to Vim (MacVim). Command mode brought me back - nothing compares. (Oh come on, you know tbizzle doesn't look THAT bad in drag)

  • Josh // December 07, 2008 @ 01:31 PM

    Yup, Vim is the ultimate! No more sore shoulders from having to reach for the mouse all the time.

  • Ted Roche // December 07, 2008 @ 05:48 PM

    I've been using SciTE for the past couple of years for similar reasons you went back to Vim: lightweight, universally available (Windows-Mac-Linux), basic context-sensitive coloring for everything from Ada to VBScript, lots of customisability available (accepts Lua scripting). I used early Visual Studio products and tried to get to like Eclipse and RadRails, but never could get all the pieces working to my satisfaction and it felt too heavyweight. But your article and pointers have encouraged me to check out Vim with the plugin scripts to see if that feels even smoother. Thanks!

  • Hatem Nassrat // December 07, 2008 @ 10:17 PM

    Why MacVim, I did install it but only so that I never have to see TextEdit. In vim try:

    set mouse=a

    or even better put this in your vimrc and use F8 to toggle

    " Turn the mouse on let g:mouseOn = 0 map :if g:mouseOn == 0:set mouse=a:let g:mouseOn = 1:else:set mouse=:let g:mouseOn = 0:endif

    as for all the menus that you have access to in MacVim, i thought you didnt want to use the mouse ;). I think the mouse is the Hack of all Hacks. They couldn't figure out how to HCI with one device so they through in a mouse.

  • Hatem Nassrat // December 07, 2008 @ 10:18 PM

    Here are the missing newlines in that vimrc command.

    " Turn the mouse on

    let g:mouseOn = 0

    map :if g:mouseOn == 0:set mouse=a:let g:mouseOn = 1:else:set mouse=:let g:mouseOn = 0:endif

  • Vineet Gupta // December 07, 2008 @ 10:33 PM

    I was about to buy a license of TextMate (for my future web 2.0 startup attempt, and I wanted to make my life easy), despite being a MacVim guy. Your post changed my mind. I am hoping its for good.

  • Nicola Paolucci // December 08, 2008 @ 01:33 PM

    I definitely share your vim love, and apparently we're not the only ones. In fact just last week I compiled a roundup of the recent vim articles/tutorials I saw pop up recently. I guess I should include your entry too.

    http://durdn.com/blog/2008/11/26/vim-mind-share-soaring-roundup-of-10-vim-articles-recent-and-older-gems/

  • nap // December 08, 2008 @ 04:39 PM

    @hatem You make a good point about mouse-enabling Vim. However, I do like some of the extra niceties found in MacVim. In particular, I enjoy easy access to the menus for infrequently used functions whose keyboard shortcuts haven't yet made their way into my repertoire, especially those from vcscommand.

    @nicola Awesome post, thanks for the link!

  • Rick Umali // December 23, 2008 @ 02:16 PM

    Hurray for Vim! I'm a huge fan myself.

Leave a Comment