dein.fr

Why I keep on using Vim instead of going back to TextMate

Charles-Axel Dein
Cover Image for Why I keep on using Vim instead of going back to TextMate
code

Disclaimer: this article only conveys my personal point of view. Please excuse my English!

Introduction

I tried numerous text editors: Komodo, Emacs, Nano, Textwrangler, gedit, SPE, Sublime, Coda, Vico...

When I discovered TextMate, I really loved it because it was both flexible and Mac-friendly. Even today, I think that it's a great tool that can greatly improve productivity.

Yesterday, MacroMates released the first public Textmate 2.0 alpha version. Its authors acknowledged the long wait that preceded this release by stating that it would "provide some relief to those who have been questioning TextMate’s future".

I began using Vim two weeks ago, and right now I don't see any reason why I would get back to TextMate. I'll try to explain in details how I got to use Vim and what are its (numerous) advantages.

Vim: Je t'aime moi non plus

Maybe some other hackers will recognize themselves in this behavior: even though I've been using Vim for a long time, I never took the time to really learn it. I used to think that Vim was too old to be interesting: the modal behavior looked really old-fashioned and counter-intuitive, to say the least.

What's paradoxical is that I kept on using Vim, primarily because it's on all computers and it's really efficient when modifying system files. Even when I tried Emacs, I kept on using Vim because it felt so much faster!

With the benefit of hindsight, it was really strange because for all the other tools I was always trying to improve my productivity (learning keyboard shortcuts, tuning configuration files, looking for ways to avoid repetition) but I never took the time to really learn Vim: for instance, two weeks ago I learned that entering a in normal mode would go into insert mode after the cursor…

Why did I suddenly became aware of this paradox?

  • I read numerous articles about Vim on Hacker News (I guess it's useful procrastination).
  • TextMate was missing key features like split windows.
  • I felt that Vim offered so much flexibility and modularity that it would be great to test it.

Vim's numerous advantages

Vim is free and open source. Well-known open source projects are superior in the long term because they are not dependent on a company's objectives.

Vim is superior for text manipulation. Most of our work in an editor consists in text manipulation. Contrary to Emacs' painful shortcuts (from my point of view), Vim's modal mode provides an elegant and efficient interface. What is more, most of the shortcuts are easily memorable. TextMate does not provide such a great combination of ease of use and effectiveness.

Vim is empowering. As Bram Moolenaar (Vim's main author) puts it, "if you spend a lot of time typing plain text, writing programs or HTML, you can save much of that time by using a good editor and using it effectively." Vim is great because it really puts you in charge. The learning curve is quite steep but it's what's exciting!

Vim has a vibrant community. I agree that it's also the case for Emacs and Textmate. For those who still thinks Vim is old, have a look at all those repositories on Github!

Vim's scripting language is straightfoward. Again, this is really personal, but I find Lisp not very well adapted to scripting. I really like Vim's streamlined scripting and configuration files. And you can also use Python or Ruby.

Vim's vision is compelling. As Jeff Bezos says, "maintain a firm grasp of the obvious at all times." To me it is common sense that a text editor should focus on efficiency and text manipulation, as Brian Moolenaar puts it:

It has always been the spirit of Unix to have separate programs that do their job well, and work together to perform a bigger task. Unfortunately, most editors don't work too well together with other programs - you can't replace the e-mail editor in Netscape with another one, for example. You end up using a crippled editor. Another tendency is to include all kinds of functionality inside the editor; Emacs is a good example of where this can end up. (Some call it an operating system that can also be used to edit text.)

Vim follows the Unix philosophy, which makes it extremely easy to use it with other programs. It is not the case for Textmate.

An editor's configuration files should be put under version control. A text editor is arguably the single most important tool for a developer. This is why it should be possible to constantly improve one's productivity. TextMate configuration files are not as easy to tweak.

Vim is everywhere. Vim is great for sysadmin because it's present on most computers.

Stuff I don't like in Vim

  • We are in 2012, the user should not have to download syntax files and activate them. It should be the default.
  • It should use Perl's regex syntax by default.
  • Help files are quite difficult to follow.

More generally, defaults could be improved. For instance, plugins management could be more automated, instead of having to install Pathogen and using git submodules. This could happen outside Vim, with a kind of universal repository for plugins and a text file that would list all the plugins (like .gitmodules). Plugin would be automatically updated regularly.

Here is another idea to have great defaults: why analyzing all the vimrc that have been posted on the web? This methodology has its flaws, but we would get a sense of what are the best defaults.

How to try Vim

If you want to try Vim, just follow these two steps:

  • Do not use any plugin or anyone else's vimrc. Really.
  • Use vimtutor to learn the basics.

Other articles