(You can skip this part and start straight from the introduction.)
Two months ago I would never have thought that I will end up writing a blog post about vi or even use vi as my primary code editor. I was more of a IDE type of person. I have experience is using CodeBlocks, Netbeans, Eclipse, IntelliJ IDEA and Visual Studio.
My first IDE was CodeBlocks which I used to write small programs in C, when I was learning to program. Then When I started development in Java I moved in to Netbeans. The transition was a swift one at that time, because I was only using CodeBlocks for few weeks. Since then Netbeans was my favourite IDE until I started using Eclipse. I had to move to Eclipse because I started Android develeopment and it was bit hard to adapt to Eclipse from Netbeans. But when the time passes and when I get familiar with Eclipse, I started loving Eclipse in the same way I loved Netbeans. Then again due to a certain project requirement I had to code in IntelliJ IDEA. At first it was really an eyesore for me. I didn’t even like the look and feel of IDEA. But as soon as I continue to work in IDEA, I figured that it is far more easy and efficient than eclipse.
Given that background of IDEs, I was never a fan of using text editors as code editors. But due to a certain work requirement, I was asked to use vi as my primary code editor and that is for a language that I am not even familiar with. Needless to say the the learning curve became very high. I had to learn a new language and on top of that do it on a text editor without entering the comfort zone of IDE.
Reluctant to use Vi as much as I do, my first approach was coding in visual studio and copy and paste it in the Vi. But I was not very pleased with the user experience of Visual Studio. In a very short time I’ve had enough of Visual Studio and thought what the heck, I don’t need auto completion. Determined to adapt to vi I started using it a few days back. And now I am completely loving it.
Vi is a text editor which is designed for Unix systems. Vi’s origin goes a long way back to ‘ed’, In between Vi and ‘ed’, there are several text editors such as ’em’, ‘en’ and ‘ex’, which helped ‘ed’ to evolve in to Vi. Vi is actually the visual mode of ‘ex’ which is written by Bill Joy. But later Bill found out that people actually spend most of the time in the visual mode. Then he separated and make Vi directly accessible to the users. If you are more interested in Vi’s origin and history, you can go through the Wikipedia article of Vi.
Vi has two modes; normal mode and insert mode. In normal mode, the keystrokes become commands where as in the insert mode they become the text inserted in the document. You can switch between modes by using ‘Esc’ (for normal mode) and ‘I’ (for inserts mode) keys.
One of the most impressive traits of Vi is you never had to take your hand away from the keyboard (to the mouse) when you are using Vi. It’s beauty lies in its configurability which provides a customized experience. On top of that you would never want to wait forever until your IDE starts. Vi loads instantaneously and allow you to do your work in the way you want to do it. If you want more testimonials on Vi users, read answers to the following Quora question.
Although at first it seems hard to adapt, at the end of the day you will be happy that you started. Below are some resources for Vi beginners , which helped me to get a hold on Vi.
What if I told you that you can have the auto completion and file explorer in the Vi too? Yes. It’s possible. Vi comes with a vast amount of useful plugins. Among which Following two are my favorites.
- Nerd Tree : Allows you to perform simple file system operations and display the hierarchical tree structure.
- You Complete Me : Fast code completion
If you have any better resources for learning or using Vi/Vim feel free to comment. 🙂