Although the “Editor Wars” between Vi and Emacs have been raging for over 30 years, some of the features of Vim, one Vi clone, could tip the scales in its favor. Vim combines some very powerful features into an elegant package that any programmer or system administrator should seriously consider.
Many techies will defend their choice of text editors to the death, and it’s a choice as controversial as politics or religion.
What is Vim?
Vim is a text editor created by Bram Moolenaar that stands for “Vi iMproved.” As the name suggests, it’s based on the original Vi text editor created by Bill Joy, later of Sun Microsystems, at UC Berkeley for the BSD version of Unix. (To learn more about BSD, see BSD: The Other Free Unix.)
History
Given Vim’s importance to modern Unix and Linux culture, it might be surprising to learn that Vim originally started life on the Amiga. Moolenaar first started working on it in 1988, based on an earlier Vi clone called STevie, which was created for the Atari ST. The first public release was in 1991 as part of Fred Fish’s famous “Fish Disks” Amiga freeware collection.
Vim was quickly ported to Unix systems, as well as just about every computer platform in existence, where it quickly became one of the most popular text editors.
Features
Vim hasn’t become a popular editor for nothing. People will support Vim for its feature set, and Vim has plenty of features.
The biggest reason for picking Vim over any of its competitors is its keystrokes. Since Vim is based on Vi, it’s inherited the older editor’s keystrokes.
Vi and Vim are modal editors, which means that they distinguish between a command mode and an insert mode. This is one of the things people either love or hate about Vim. Users move the cursor around in command mode and actually edit text in insert mode.
Thanks to its modal nature, Vim’s learning curve is very steep, but once users have mastered its commands they can perform complicated tasks in a few keystrokes.
The advantage to working this way is that almost all of the commands are on the home row, instead of using the Control and Alt keys in Emacs. Some people, particularly touch typists, find this scheme much more comfortable.
One thing that makes some people choose Emacs over Vim is its support for scripting. Since Emacs runs a version of Lisp, it’s possible to create modes and other features, even a Tetris game.
Vim is programmable as well, letting users download or create plugins to extend the editor in a special scripting language.
Vim also has some features that make it live up to the name of an improved version of Vi. One of them is support for multiple windows, which lets users switch between multiple files. (This was a feature that Bill Joy actually planned to add to the original Vi, but a disk crash forced him to stop working on it in the early 1980s.)
Another major addition is support for graphical user interfaces. There’s a version for the X Window System available in most Unix/Linux package managers, as well as native ports for both Windows and Mac OS X.
One of Vim’s best features might be its cross-platform nature. It originally started on the Amiga before being ported to a wide variety of operating systems, from Linux to Windows, even more obscure platforms like QNX. It even runs on the iPhone and iPad.
While Vim has an open-source license, one of its licensing terms is unique. Bram Moolenaar encourages users to donate to his organization, the ICCF, to help children in Uganda. This has caused Vim to be dubbed “charityware.” If you’re a serious Vim user, you might want to consider paying it forward yourself. (For more on open-source licensing, see Open-Source Licensing – What You Need to Know.)
The Winner of the Editor Wars?
The “Editor Wars” between Emacs and Vi have been going on for years, but Vim might finally be the winner of the classic Unix editors.
While a Usenet poll found that nearly half of all users preferred either Vi or Emacs, later surveys have shown a preference toward Vim.
In 2006, the readers of Linux Journal voted Vim their favorite text editor by a wide margin. A Stack Overflow survey of programmers found more variance in their editors of choice, with Notepad++ the most popular choice. Again, Vim was the most popular “classic” text editor. Notepad++ is Windows-only, so this reflects the fact that most developers are using Windows for their day-to-day use.
The editor field is a lot more crowded than it was in the ‘80s and ‘90s, but Vim has come a long way from its humble origins.
Conclusion
Vim is a powerful and relatively lightweight editor, even with its extensive feature set. It builds on the tradition of Vi while adding many powerful editing features, combined with wide portability. This means that Vim will become the most powerful tool in the arsenal of many programmers and system administrators for a long time.
If you’re interested in learning Vim, there are plenty of tutorials online.