Why do I use Vim?


Update 2023: Many things have changed since I wrote this post 9 years ago. After 4 years of using Vim, I switched to use Emacs with different flavors for another 4 years. At the moment, I’ve settled with VS Code and Vim extension.


Ok, it’s not a new topic. This article came up when I got pair with my colleagues and saw how they used some text editors unproductively. If you’ve already a Vim user, there is nothing new. Otherwise, you may find some interesting features that convince you to use Vim. Frankly, I’m not a Vim expert, but a guy has used it for several years and still surprised Vim’s possibilities.

I’m not going to tell you how to start or learn Vim, there are a lot of tutorials available and good books just to teach you how to use Vim.

Vim
Copyright (c) 2007 Laurent Gregoire
Productivity

Productivity

The first thing we should think of is certainly coding productivity. The developer is most productive on his favorite editor as people always said. Why do we have to care of (yet) another text editor? I’d say that my productivity was double times since switch to Vim two years ago. So, what is VIM unique feature that can make you get a double your coding speed.

The salient part has to be Vim key bindings. In most circumstances, Vim encourages users not to use mouse but keyboard as the input device only 1. It happened because Vim’s origin is Vi, an editor was born at the time most of computers had no mouse and even keyboard’s arrow keys.

Terminal ADM 3A
Have you ever think of using computer with this keyboard?

Well, it looks like you are using old-school editor. However, when your fingers is tightenly on keyboard with focusing only on typing without distraction of moving mouse around the screen to finding something to click unconsciously, you’re likely to feel the Vim’s way. I would say my productivity is double with key bindings comparing with my previous text editors.

It’s not easy at first to write or code without mouse and arrow keys, but you have to take 1 step back in order to have 2 steps forward in this case.

In addition, there are tons of ready-to-use plugins to support syntax highlight, code completion, code format, folding, etc., which certainly make our programming’s life happier 2.

Unique Vim

Unique Vim

Vim educates its user to customize it as much as they want.

Have you ever think of using an text editor which you have full control of all features and improve it whenever possible. Probably not. If yes, Vim is surely your way to try. The Vim core give us not so much out of the box feature, but its flexibilty is the way that Vim can be seen as one of most powerful text editor. As starting using Vim, I constanly see myself need to improve every bit of key bindgings, try some plugins, and tweaking them to work as my expectation. Eventually, it let to the fact that every Vim user has his own specific key bindings and combinations of plugins which he think it’s the most reasonable way to use. So it’s not someone’s text editor, it’s your own text editor to improve, to write, to code, and to proud of. From time to time, you recognize that you can actually program a plugin for Vim. Writing code is an unique actitity which I think it worth a unique tool like Vim to work with.

GUI, please!

GUI, please!

The purpose of a GUI is to make simple things simpler and complex things impossible.

Vim can run on most of popular OSes out there 3. No matter where you work, Graphical User Interface (GUI) or Command line, Vim is always the same. Thanks to Vi. Whenever I need to work on DevOps tasks, it would be horrible without Vim available. Often, when editing document on servers, you will have the same comfort as writing code on desktop if Vim is your editor.

Drawbacks

Drawbacks

Not everything is perfect nor Vim. It’s widely known that Vim has a steep learning curve that may use out of all you patience when trying to adapt it.

I would say it’s true if you’ve never left GUI environment before. The barrier mostly comes from the weird key bindings and vimscript which you need to invest time to learn it use.

text editor learning curves
Text editor learning curves

This figure may not be 100% accurate, but it gives you sense of how challenge your learning Vim journey would be.

Conclusion

Conclusion

My point is not to convince programmers need to make a switch right away when their daily jobs tighten to a single - monolithic Integrated Development Environment (IDE) such as .NET or iOS developers with Visual Studio or Xcode.

Generally, IDEs have their own advatanges in code generation or advanced debugging when you actually need to use it.

After learning Vim for sometime, the possible solution is to apply Vim key bindings to your favorite text editor (or IDE) and remember how slow you were without Vim key bindings.

To Vim, I think every programmer should give it a try. If you’ve never use Vim, then forget how the first time you write a document on computer, pretend that your mouse is away from your handside, learn it bit from bit. It’s a worthwhile experience.

Footnotes

Footnotes

  1. You may find Vim distributions such as gvim and Macvim support mouse and GUI menu bar in some limited features.

  2. Vim can run on Unix, Linux, Windows, OS X, iOS and Android.

  3. http://www.vim.org/scripts/