7 reasons to love Vim

3 readers like this.
open source work experience

Opensource.com

When I started using the vi text editor, I hated it. I thought it was the most painful and counter-intuitive editor ever designed. But I'd decided I had to learn the thing, because if you're using Unix, vi was everywhere and was the only editor you were guaranteed to have access to. That was back in 1998, but it remains true today—vi is available, usually as part of the base install, on almost every Linux distribution in existence.

It took about a month before I could do anything with any proficiency in vi and I still didn't love it, but by then I'd realized that there was an insanely powerful editor hiding behind this bizarre facade. So I stuck with it, and eventually found out that once you know what you're doing, it's an incredibly fast editor.

The name "vi" is short for "visual." When vi originated, line editing was the norm and being able to display and edit multiple lines at once was unusual. Vim, a contraction of "Vi IMproved" and originally released by Bram Moolenaar in 1991, has become the dominant vi clone and continued to extend the capabilities of an already powerful editor. Vim's powerful regex and ":" command-line syntax started in the world of line editing and teletypes.

Vim, with its 40 years of history, has had time to develop a massive and complex bag of tricks that even the most knowledgeable users don't fully grasp. Here are a few reasons to love Vim:

  1. Colour schemes: You probably know Vim has colour syntax highlighting. Did you know you can download literally hundreds of colour schemes? Find some of the better ones here.
  2. You never need to take your hands off the keyboard or reach for the mouse.
  3. Vi or Vim is everywhere. Even OpenWRT has vi (okay, it's BusyBox, but it works).
  4. Vimscript: You've probably remapped a few keys, but did you know that Vim has its own programming language? You can rewrite the behaviour of your editor, or create language-specific editor extensions. (Recently I've spent time customizing Vim's behaviour with Ansible.) The best entry point to the language is Steve Losh's brilliant Learn Vimscript the Hard Way.
  5. Vim has plugins. Use Vundle (my choice) or Pathogen to manage your plugins to improve Vim's capabilities.
  6. Plugins to integrate git (or your VCS of choice) into Vim are available.
  7. The online community is huge and active, and if you ask your question about Vim online, it will be answered.

The irony of my original hatred of vi is that I'd been bouncing from editor to editor for five years, always looking for "something better." I never hated any editor as much as I hated vi, and now I've stuck with it for 17 years because I can no longer imagine a better editor. Well, maybe a little better: Go try Neovim—it's the future. It looks like Bram Moolenaar will be merging most of Neovim into Vim version 8, which will mean a 30% reduction in the code base, better tab completion, real async, built-in terminal, built-in mouse support, and complete compatibility.

In his LinuxCon talk in Toronto, Giles will explain some of the features you may have missed in the welter of extensions and improvements added in the past four decades. The class isn't for beginners, so if you don't know why "hjklia:wq" are important, this probably isn't the talk for you. He'll also cover a bit about the history of vi, because knowing some history helps to understand how we've ended up where we are now. Attend his talk to find out how to make your favourite editor better and faster.

User profile image.
I'm a librarian, computer geek, photographer, areligious Buddhist, and ex-engineer from Toronto. I have a degree in Mechanical Engineering (Toronto) and another one in Library Science (McGill). I spend my spare time writing Python, HTML, Bash scripts, whatever language I'm learning right now, working with Linux, and watching movies. I edit everything in (Neo)Vim.

13 Comments

You knew you would get an opposing view from an emacs user! There are many articles posted, but I will present only one. http://www.techrepublic.com/article/why-i-love-emacs/

Besides emacs being far more powerful than vi/vim, the bizarre two modes, command and editing, is far outdated. emacs is not perfect by any means, but is everything I, or anyone needs in a text based programmers editor.

GNU Emacs 20.x branch was released in 1997, but by this point the "traditional" vi effectively fell by the wayside, with a full branch and port into nvi and all the other variations. I could say that OS X is better than Windows 3.11, but it's not a reasonable comparison either.

In reply to by Scotsgeek (not verified)

There is also Cream http://cream.sourceforge.net/download.html

Cream is a plugin that makes gvim act like act like a modern editor. With cream, you can use the mouse and common accelerators (Ctrl+C for copying,...) rather than memorize its keystrokes. :)

Actually I believe vi stood for "visual interface" and it was bolted onto the ex line editor.

The history explains why vi has two modes: data entry and editing, but doesn't make them any more acceptable to me, in fact it annoys the living poop out of me on those occasions when I have to use vi.

I'm in the emacs camp, BTW, but if I want something smaller and more responsive I'd go for joe or nano.

Emacs is not bad operating system, all it lacks is decent text editor...

Good calls, Shawn: I use that xkcd comic in my talk slides, and I recommend Cream for Windows users (not so much for Linux users).

I'm a big believer in "use what works for you." I love Vim, but if Emacs works for you - more power to you. I don't see much point in that dying rivalry: they're both good editors. In fact, Github's Atom is an excellent editor too, and you should try several editors to make sure you've got the one that works best for you.

I always install nano for line text editing, vi is too complicated.

By the early 2000's, I lived in a three editor house. TextPad for Windows, BBEdit on the Mac, and Vim on Linux/BSD. One day I woke up and decided that was two editors too many, and since Vim ran on all three platforms, I decided to dump the other two and just learn Vim. I had been using Vim for about three years before that, but only in the most general sense. I bought Steve Oualline's Vim book, read it cover to cover, and really started working and practicing my Vim. Fast forward to now, and I teach Vim to my team mates, helping them discover the power and simplicity of this fantastic editor.

I beginning to "like" Vim mainly due to colour syntax highlighting.
Anyone know how I can get the programs More or Less to do colour syntax highlighting?

I'm not aware of a way to do syntax highlighting in less or more. You can however use (n)vim for that: 'nvim -M -R filename'. This'll give you the same syntax highlighting you get in vim, but the flags turn off the ability to edit. In the past that command was aliased to 'view', but it doesn't seem to be available on most Linux distros anymore. You could set it up yourself, just add 'alias view="nvim -MR "' to your ~/.bashrc.

vim-plug is a superior option over Vundle and works in the same way just better.

A great article. I first started using vi in 1984 on our first Unix box, made by a company called Convergent Technologies. I recall cursing it for quite awhile but one day my fingers had learned all the commands I need and for the last 30 years or so it has been the number one choice for me; and since 2005 that's been vim.

I think the interesting thing about both vi(m) and emacs is that once a person gets to the level where they don't need to think about how to do things and can concentrate on what they are doing, it becomes painful to use another editor, especially one that forces the user to futz with the mouse.

I don't see anyone mentioning it above but there is vi-like plugin for the Netbeans IDE that mostly gives you vi in the code composition window.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.