Vim is an improved version of the Vi text editor which has been kicking around since 1976. After some initial scepticism I've found that is an incredibly powerful and useful tool. I'm just learning but all ready feel that my productivity is increasing.
Why Vim?
I never thought I'd feel excited enough about a text editor that I pony up the cash to pay for it. After all its just a text editor right? Well that's what I thought until I found
Textmate for my Mac. This seemed to bring a whole slew of new features that made coding faster and easier. I'm sure that I wasn't even using a fraction of the available abilities. Then I moved to Linux and found gEdit which is just a plain old text editor. Now I spend a lot of time at work ssh-ing to unix boxes and if I need to view or edit a file my choices are limited. The commands used in less and more, translate to Vim so I needed to learn about more (bad pun intended) about it. I found that once you've learned relatively few commands you can navigate round a file in no time. I decided to see if Vim could be useful as my default editor at home as well. The
Vim website has binaries available for installing gVim (a Gui based version) for Linux, Mac and PC so I didn't have to code inside a terminal window. I also downloaded an excellent 4 part video tutorial from Net Tut's called
Venturing into Vim by Jeffrey Way. This series was very useful in explaining the basics (and some advanced stuff). If you're wanting to learn more I'd highly recommend this series.
So what's so cool about it?
When I work I prefer to have my hands on the keyboard as much as I can. I don't like to be continually moving my hand off to grab the mouse. Vim lets me not only insert and edit text but also to navigate without having to wave my arm around. This translates to faster input. Once you're familiar with the Vim way, most commands are intuitive and seem to be the logical way to do things. Even though its text based you can still use tabs or split the screen vertically or horizontally (and multiple times). You can carve up your workspace to make it however you want. Check out this screenshot. I defy you to do that in your vanilla flavoured editor.
This is just one of the many flexible things you can do with Vim. Its not an IDE but its totally lightweight and can support syntax highlighting.
The trick with Vim is that it is like a language all on its own. Once you've become familiar with it, it will quickly become second nature. Part of the curve is that Vim has a number of different modes: command, insert and visual. Depending on what mode you're in, keystrokes will mean different things. For example, in command mode [shift] + g will move you to the end of the document, while in insert mode it will give you a capital G. By default you start in command mode and you choose to enter text by one of the many insert commands. For example i to insert before the cursor, o to insert on the next line, a to insert after the cursor, A to insert at the end of the line. The options are plentiful. Do a quick google and you'll find any number of cheatsheets and shortcut lists available for Vim so I'll not repeat them here. The thing to remember is that once you've finished in insert mode hit [esc] to go back to command mode. This is a lesson that's learned from experience as I seemed to finish my text files with :w!
You can change the colour scheme from the plain black and white to a number of provided colourful schemes. I'm using the quite dark "ron" scheme at the moment. If you want to set a scheme to load by default you can add a .vimrc file to your home directory. This can be used to customise your Vim with all sorts of things, such as line numbering, syntax highlighting (I've tested it with Java, Groovy and HTML) and auto indenting.
I'll post more about Vim as I learn but so far I'm thinking that if you can type Vim might be the editor for you.