Penguin
Note: You are viewing an old revision of this page. View the current version.

The "other" text editor for Linux. Emacs is a fairly standard text editor used for programming under Linux, Vim is often known as its slightly less-used cousin.

Vim is an evolution of "vi", a text editor that comes installed with Unix. "Vi" wasn't exactly free and quite limited, so Bram Moolenar created Vim. Vim now has many more features than "vi" but still contains the basic interface and usage.

Vim (and "vi") is rather unique among text editors because it operates on the fact that there are certain "modes" that the editor can be in at any one time. The mode Vim is in upon startup is "normal" mode, press the key "i" and the editor goes into "insert" mode where the user can type text. This is perhaps what stops many people from adopting it. Nevertheless, Vim is quite a popular text editor and many programmers swear by it.

Though "vi" originally only worked under Unix, Vim has been ported to almost every platform under the sun. More information can be found at http://www.vim.org or http://vim.sf.net.

See VimHowto.

The best thing about all the versions of vi and vim is that they're all the same, except for when they're different. For example, on some machines (eg real unix), your arrow keys don't work. You have to navigate using "h", "j", "k" and "l". And only in normal mode - pressing these keys in insert mode just inserts that character. Some versions do let you use the arrow keys, but they only work in normal mode - pressing the arrow keys in insert mode inserts the control code generated by the keypress instead. Sometimes (normally using vim on linux) the arrow keys work as expected, in both insert and normal modes. Sometimes the arrow keys work, but if you press an arrow key in insert mode, it will change to normal mode (as well as move the cursor). To be fair, these observations aren't really vim's fault, but it's what I think of when I think of vim. Having said that though, I still use vim a lot, especially for smallish tasks.


In defense of Vim (or actually, in offense against other editors), it has to be noted that although it may seem so, the concept of modes is not unique to Vim but inherent in every editor. In Emacs f.ex, you "enter normal mode" by pressing Ctrl; as long as you hold that key, you can enter command shortcuts. Once you let go (and optionally enter some command or whatever), you're "back in insert mode". GUI text editors work much the same way - once you activate a menu, keystrokes get interpreted as menu navigation -- essentially command shortcuts --, and no longer as text input. You get back to "input mode" by leaving the menus.

So basically, Vim works much like any GUI editor except for the lack of displayed drop down menu. And unlike any GUI editor, it has a CommandLine with a vocabulary that leaves little to be desired once you've memorized a handful of the commands.

Another thing to remember is that as opposed to Emacs, even the bog standard vi(1) offers a huge pile of bindings out of the box. You don't need to synchronize dotfiles across machines or spend a lot of time settings things up to find an environment that's likely to be very similar to what your very own configuration feels like. You can immediately work productively on any random machine a vi(1) is installed on (which means everywhere).

--Aristotle "Vim is awesome" Pagaltzis :)

The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • BartvanDeventer
The following authors of this page have agreed to the WlugWikiLicense.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php:111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument