Vim · Posted: Dec 22, 2008
Doing bioinformatics I only use two tools: the keyboard and the mouse. Since I use these tools all-day, everyday I want to use them efficiently. My opinion is that using the keyboard as much as possible while the mouse as little as possible, is the best way to work at a computer. In a simple example, knowing the keyboard shortcut to run a given command means that I can execute the command quickly without breaking the flow of typing. The text editor Vim takes this to another level and is entirely keyboard driven. There are no drop down menus and everything is performed using the keyboard; there’s no reason for my hands to leave the keyboard. The large number of commands for Vim means there is a fair amount of practice required before you can use it fluently. I think this practice is a great investment though, as being able to use Vim intuitively makes you work faster and more efficiently. The reason for this is because Vim has a huge functionality to be taken advantage of, using just a few quick remembered keystrokes.
As Vim is entirely text-based, without the pretty interface of modern editors, my original opinion was of an archaic hangover from the early days of Unix. Vim is around twenty years old, but is still a sophisticated text editor with a large range of functions. The large range of vim’s functionality means a steep learning curve, but the extensive help documentation is an eloquent and gentle introduction. The commands “:vimtutor” and “:help” are the places to get started for using Vim. Vim’s greatest feature is how easy it is to move, edit and manipulate text. This can sound trivial, but reordering paragraphs in minutes with a mouse, takes just seconds using the keyboard with Vim. This example is applicable to any type of text file, such as Ruby or LaTeX source code, which is what I spend most of my time editing. Another Vim feature are the registers, which act as super-charged clipboards. Not only can text be stored for pasting, but also sequences of commands as well. Stored commands can then be replayed by calling the register, this eliminates performing repetitive actions. Typing “:help usr_10” is a good place to start for learning about using registers for commands, as well as other ways of making large changes quickly.
One reason not to use Vim, is that it doesn’t have the code orientated features of integrated development environments (IDE) such as Eclipse and Netbeans. But it does. Vim is easy to customise which has lead to a community of developers creating a large number of plugins. Code snippets, project drawers, and fuzzy file finding are just some examples of plugins aimed at using Vim as an IDE. Whatever language or framework you use, someone will have written a Vim plugin. This gives Vim all the functionality to rival any IDE.
Interested in bioinformatics and data analysis? Follow me on twitter.