Vim is not just an editor. It can be an IDE if used at its best. I have found it more convenient to use than any other word processing tool i have used. With proper knowledge of the countless features provided by vim, one can be much more efficient in whatever editing job, and programming in my case.
Every time i wished for a feature, i found it there in vim. I didnt allow myself to do anything the stupid way, and always figured out a better way to do the same thing. Thats how i have got a decent expertise on vim. With this tutorial i wish to give you a feel of what all is possible with vim, and show you a direction to learn more.
Before i proceed, i would like to ask you a question. Suppose you have got a file with about 50 lines only, and you have to make few changes to the file. Lets assume that you are asked to add 10 to every number present in the file. Lets assume that there are only 25 numbers in the file and rest is text. Would you start doing it the stupid way or search for a efficient way to do it ?
Most of the times one will think that its just 25 numbers, and without thinking about a better way to do it, he just starts doing it right away. Or even if one does want to do it a better way he doesnt do it thinking that figuring out the better way will take much more time than doing it the â€˜obvious wayâ€™. But what we always ignore is that its not just this time. We do it many times, and thats why it makes sense to go for the better way to do it, even if it takes more time at first time.
So next time when the thought â€œits just this muchâ€ comes to your mind, just remember that â€œits not just this timeâ€ , and the choice is yours.
If we go by Brook’s words “The tool that save the most labor in a programming project is probably a text-editing system” [The Mythical Man-Month, proposition 12.10], then we should probably work on our editing skills more than our programming skills.
In this tutorial I assume the reader to have a basic knowledge of vim. Basic features like editing, movement, searching, replacing, opening, saving etc not covered in this tutorial. I’d recommend going through vimtutor for basic understanding of vim.
Link to the tutorial (pdf)
“if its just this much, its not just this time”
This tutorial was prepared for my guest tutorial on March 28, 2006 for ug1 batch.
Updated May 12th, 2006 with features of vim 7.0 ( Tabs, Undo Branching and Spell Checking).
Thanks to Paresh Jain for helping me with LaTeX. Otherwise it wouldnt have been possible to write it using vim and I wasnt doing fair to it by writing it in anything else.
* vim recording