Kata:Ruby:Tail Recursive Prime Factors
Why I Always Ask To See Code

Why I switched from TextMate to Vim

It wasn't because I was used to vim. I wasn't. In fact, aside from editing configuration files through ssh for the occasional sysadmin work I'm call upon to do, I'd hardly ever used vim before.

I started to investigate vim because I had hit a productivity plateau with TextMate. I had learned the majority of the useful shortcuts. I had installed all kinds of bundles, and even made a few. But I still had moments where I thought to myself "I'm wasting time with this", and I had no clear way to make them better.

I started to think that this was holding me back, not in the actual time it was taking, but in the way it affected how I write code. Programmers love efficiency. They tend to repeat actions that are efficient, and avoid those that aren't. As a result, your development environment has a direct effect on how you write code and what code you write. It encourages efficient actions and discourages inefficient ones. The problem is, what's efficient in your editor might not be the best thing for your codebase.

I wondered how I would write code differently if all my modifications had zero cost. If I could add methods, remove classes, rename variables and add new statements in the blink of an eye, I would make different choices about how I code...I don't think it would just be the same thing done faster. I might start writing more exploratory tests. I might use inline assertions more often. I might favor a failing test over firing up a debugger more often.

So I started worrying that inefficiencies in my work environment were encouraging me to take an approach that was, overall, less optimal. This has lead me to some pretty serious thought about what a truly optimal environment would be like. So far, I've come up with four properties of an ideal programming environment:

  1. Actions are accessible without switching contexts
  2. Feedback is immediate and relevant
  3. The environment is self documenting
  4. The environment is easily evolved

So the reason I switched from TextMate to vim, is that I think vim gets me closer to an ideal environment. Will it get me all the way there? I don't think so. I do think that I'm already more productive using vim (even after just a month of learning it) than I ever was with TextMate...and I'm still learning. I also think it's going to be a very long time before I hit a productivity wall like I did with TextMate. There's just so much to learn in vim.


Feed You can follow this conversation by subscribing to the comment feed for this post.


Welcome to vimland, Ben.

Ben Rady

Thanks, Tim, it's good to be here.


welcome to the war against emacs, ben

Giorgio Sironi

>If I could add methods, remove classes, rename variables and add new statements in the blink of an eye
How do you performs such refactorings in Vim? I am learning too. :)

Ben Rady

Depends on the language you're using. If you're working in Python, try Rope. I'm still looking for a good Ruby refactoring plugin.

Kevin Taylor

Great to see another convert. The learning curve is steep but the rewards are great.

Les Stroud

Would you be willing to post some screencasts showing the differences from a productivity perspective?

Ben Rady

I don't have one handy, but here's a good example. I have yet to find a way to do many of the things in this screencast in TextMate...


Gary Bernhardt

With both Vim and Emacs, there's always more to learn, and always more power to uncover, which makes them perfect for those of us who don't know the words "good enough." :) Of course, Emacs users are eventually defeated by RSI, while Vim users eventually attain editor Enlightenment! [0.9 ;)]

Isa Goksu

I don't quite get why you switched :) Is this because there was a learning curve?

To me all these Vi and Emacs folks live in Plato's sunworld :) I admit that Vi and Emacs can be really powerful if you manage to press 7 keys in a consecutive order :) Lots of plugins for both of them, and you can do magical things with them, but you must keep 300 combinations in your mind.

TextMate or any other editor is not a silver-bullet. I've been using Vi (8 years) and TextMate (3 years). And the only disadvantage of TextMate that I found is, it's not working in SSH connections :) Here is some shortcuts for your summary of a ideal development environment items:

1. Actions are accessible without switching contexts (try ⌘⌃+T)
2. Feedback is immediate and relevant (this is only valid for big IDEs like IntellijJ, Visual Studio or Eclipse)
3. The environment is self documenting (vi or emacs are definitely not in this group :) for TextMate try: ⌘+T, ⌘⇧+T, ⌘⌃+T, ⌃⇧+P sort of shortcuts or check bundle editor for any sort of access or documentation)
4. The environment is easily evolved (I think pretty much all editors are easily evolving in these days)

Maybe I'm wrong, but so far there is not much of a thing that I can't do in TextMate. Instead of watching fancy Vi screencasts, maybe people should try watching TextMate screencasts :P

The comments to this entry are closed.