What could be said about the Vim text editor that isn't already said? Well, apparently a lot, since you can still see people actively writing blog posts, coding amazing plugins, and discussing better ways to do things. Also, many new people come to Vim, so I decided to help them a little bit sharing my modest knowledge.
Note: this page and subpages are in their early stages yet.
Introduction, and first notes
How I learned Vim (and why that was good for me)
The first months
I started using Vim as the best, simple, and very widely available text editor in the console of Linux systems, with the advantage of being amazingly compatible and/or coherent with other existing tools that are so common in those environments (like sed, or the tools that show you man pages, etc.).
Even better: this tools are not only Linux specific, since are available on Mac OS X or other UNIX-related systems. If you ever have to touch an old Solaris, or a small embedded system, or the rescue console for your Linux box (like with BusyBox), is very likely that you will be able to use something as important as a text editor to work on it, since some sort of vi will be there.
If you just want to use an editor when connected to a remote system through SSH, Vim is (in my humble opinion) a great choice, even if you just use in normal mode the features that are available to a simple tool like less, like moving with "jkhl", CTRL-F and CTRL-B for going one page forward or backward, and searching with the slash key. Again, in my opinion, is preferable to use a modal editor like Vim only knowing how to use these features, than having to resort to GNU nano (or other), since with Vim (even the Vim version compiled with minimal features) I know I can slowly learn new tricks that nano will never have, and I know that this features will be similar in the interface like other common UNIX tools.
Vim's features and the interface to them is closely related to the UNIX culture. For example, doing substitutions is very very similar in Vim and in sed. Even such a basic console tool like grep owes its name to an instruction that is a very powerful feature in Vim, and that comes from the ed text editor.
The first years
After a brief period where I only mastered the very basic functionality that made Vim just a little bit more powerful than a basic editor, I started learning some sequences that did useful things, but without understanding them. Editing a configuration file it was very useful to know that typing something like
ct", the text from the cursor up to the next quote was deleted. When editing a document, I knew that typing
gqap reformatted the paragraph I was on.
But I didn't understood the reason why things were the way they are. I knew there was a reason, but I didn't knew that it was such a compelling one! I simply could not imagine that learning more about how those commands worked was worth the effort.
I had some basic configuration in a vimrc file, but I also had some system wide changes for editing as super user. I did some mistakes in there, and I certainly proved that I was wrong about many things about how Vim behaves: I searched for solutions, and very often I found pretty bad advice of people who got a working configuration, but one that broke other features that they were ignorant about.
The last years
Finally, there is a period that started some months ago, and that I think that will be the last one till I stop using Vim (if that ever happens).
I decided to use Vim for some "serious" coding. I was procrastinating about a university project (a master's final thesis) that involved some PHP programming. By chance, I found the slides of a presentation about using Vim for PHP coding, and I realized it presented many small ideas that were easy to grasp, and very attractive to use. I started using Vim for that project, and I finally started learning Vim for real. Not just a basic tutorial with nice tricks. I started learning almost all the details about some features. If learned about movements, and I was unable to memorize all of them all of a sudden, at least I bothered to know that some movements at least existed, and it would be nice to come back to the manual to learn them when time permits.
Also, I started using plugins. Initially one probably starts adding plugins because wants to change the color scheme, or because wants support for a new file format (or a better support for an existing one). Then I was mind blown by some of them. The fact that some amazing videos were available on Vimcasts made everything quite easy, because is easier to be seduced when you see real use of some feature. Drew Neil did an amazing job in promoting Vim with that website.
- Don't copy lots of settings to your vimrc all at once (and certainly, don't use somebody else's vimrc). Start with a vimrc completely empty, or very very minimal if it comes from some trusted source (ask a list or forum for advice).
- Don't use a Vim “distribution” or “bundle” that ships many plugins all at once.
- Start with exactly one plugin: one that helps manage other plugins. There are lots of them. For now, I recommend pathogen, as is the simplest one I can imagine, and just works.
- Vim/Teclado español (in Spanish, sorry): about the changes I did to accomodate the layout of the Spanish keyboard.