What are the benefits of learning Vim?
I've been using vi and vim also for some 20 years, and I'm still learning new things.
David Rayner's Best of Vim Tips site is an excellent list, though it's probably more useful once you have some familiarity with vim.
I also want to mention the ViEmu site which has some great info on vi/vim tips and especially the article Why, oh WHY, do those nutheads use vi? (archived version)
Running through vimtutor only took me 30 minutes, which was enough to get familiar with vim. It was worth every second of it.
If you're a programmer who edits a lot of text, then it's important to learn an A Serious Text Editor. Which Serious Text Editor you learn is not terribly important and is largely dependent on the types of environments you expect to be editing in.
The reason is that these editors are highly optimized to perform the kinds of tasks that you will be doing a lot. For example, consider adding the same bit of text to the end of every line. This is trivial in A Serious Text Editor, but ridiculously cumbersome otherwise.
Usually vim's killer features are considered: A) that it's available on pretty much every Unix you'll ever encounter and B) your fingers very rarely have to leave the home row, which means you'll be able to edit text very, very quickly. It's also usually very fast and lightweight even when editing huge files.
There are plenty of alternatives, however. Emacs is the most common example, of course, and it's much more than just an advanced text editor if you really dig into it. I'm personally a very happy TextMate user now after years of using vim/gvim.
The trick to switching to any of these is to force yourself to use them the way they were intended. For example, in vim, if you're manually performing every step in a multi-step process or if you're using the arrow keys or the mouse then there's probably a better way to do it. Stop what you're doing and look it up.
If you do nothing else, learn the basic navigation controls for both vim and Emacs since they pop up all over the place. For example, you can use Emacs-style controls in any text input field in Mac OS, in most Unix shells, in Eclipse, etc. You can use vim-style controls in the less(1) command, on Slashdot, on gmail, etc.
Have fun!
Could I live without it? Easily.
Is it useful? Yes.
Reasons for Learning
vi is guaranteed to exist on all Unix systems and exists on most Linux ones as well. That kind of broad coverage makes learning it worth it.
It's much quicker to use vi for a
sudo
edit:$ sudo vi
Also, GMail uses vi-ish commands for selecting & moving emails around!
You don't have to be a master.
Just learn
The basics:
- How to switch from command mode to insert mode i
- How to switch from insert mode to command mode Esc
- How to navigate up a line in command mode k
- How to navigate down a line in command mode j
- How to navigate left a character in command mode h
- How to navigate right a character l
- How to save a file
:w
Enter (write) - How to exit without saving (in command mode)
:q!
Enter - How to Undo u
- How to Redo Ctrl+r
- You can combine writing and quitting (in command mode):
:wq
Enter
From there the rest will just make you faster.