Bill Joy, of Joy's Law fame1, among other things, wrote the code for Vi in 1976 as the visual editing component of the ex editor.
Then In 1979, Joy released Vi into the wild as a standalone editor. It did well but ran up against licensing restrictions.
Then in 2000, Gunnar Ritter ported Joy's original Vi to the modern Unix-like operating systems, producing the default editor.2
Bram Moolenaar then added an astonishingly extensive, powerful feature set to create what we know now as Vim3
Moolenaar released Vim as free and open source software under a GNU General Public License (GPL) compatible license, adding a charity clause encouraging Vim users to donate to an organization helping hungry children in Uganda.4
He's doing real work to feed hungry children with the help of Vim users who've donated to this cause.
Vim is everywhere
Even if you're still not convinced that Vim is worth the trouble, consider that it's so ubiquitous on Unix-like operating systems that many configuration utilities use "Vim" by default.
To the end of helping users develop quick competence, Vim has a built-in help function called
vimtutor that you can run from the command line, along with excellent documentation.
The key to learning Vim quickly is understanding the two primary modes: the
command mode and the
Insert mode. Once you understand the modal editor model, the basics of using Vim fall into place.
Vim starts in command mode, enabling you to enter commands. Vim is too much to take in with one drink, so here are some commands that will give you an immediate boost to your productivity, serving as a sound foundation for further progress.
You can get around your file efficiently with these commands.5
|Up Arrow||Navigate up|
|Down Arrow||Navigate down|
|Right Arrow||Navigate right|
|Left Arrow||Navigate left|
|CTRL-E||Down one line|
|CTRL-Y||Up one line|
Turn the efficiency knob to 7
You'll notice an increase in your effectiveness in Vim with each new command you learn.
|i||Insert text before cursor|
|a||Insert text after cursor|
|I||Insert text at start of line|
|A||Insert text at end of line|
|o||Open a new line below current line|
|O||Open a new line above current line|
|$||To end of the line|
|w||Forward one word|
|b||Backwards one word|
|G||Navigate to end of file|
|gg||Navigate to the beginning of file|
|.||Navigate to the last edit|
If you want to turn the efficiency up to 11, fear not, Vim is the perfect vehicle for turning it up to 11. The resources referenced below will get you the rest of the way there.
When you're ready to edit the file, you'll type the letter I to switch to Insert Mode. This mode is just for Inserting text whether you're typing it or copying and pasting.
When you're ready to save the file, you'll hit Esc to switch to command-mode, then enter
`:wq (write to disk, then quit) or just enter
:w to _save without quitting or
:q! to _quit without saving if you munge up the document or realize you're in the wrong config file.
There is at least one other mode but extra modes would be a distraction to the perfection possible toggling back and forth between
I for Insert mode and
A couple more key features
Vim has considerably extended regex capabilities, but start with a simple find and replace. In command mode, enter a
: followed by the
%s (substitute) command.mFor example,
:%s/foo/bar/g replaces each instance of
Another command you'll likely find useful is
:set number, which toggles line numbering in Vim.5
The next steps
When you've mastered the basics, you'll realize an immediate increase in your efficiency. You could now continue on as a moderately competent Vim user, getting stuff done, yet the model rocket only going about 20 feet off the ground.
• Here's a good article outlining Vim's astonishing feature set.
• If you're after some more quick efficiency gains, then Vim Tips and Tricks is your next stop.
• If you seek to reach higher levels of Vim mastery, then go to the source: Vim's website
I've heard it is possible to reach the highest level of Vim mastery if you can resist succumbing to astonishment at the vastness of this seemingly unassuming text editor. The good news is that the Vim community writes good documentation.
"No matter who you are, most of the smartest people work for someone else (other than you)." ↩
You can also use the letters k, j, i, or h to navigate up, down, right, and left. ↩
Back to Top