The Bottom Line
The Vim editor is a powerful editor available on all major platforms. Since it's intended for writing code, it's also an ideal editor for writing Ruby code. Though you may not see the advantage of learning Vim, you'll quickly see the benefits if you start using it.
By not having to leave your keyboard to use the mouse, you can quickly issue commands and continue editing. Vim even maps some of the home key keyboards to cursor movement keys, so you never even have to leave the home row. In short, you can edit much faster with Vim.
- Available on all major platforms
- Powerful text editor intended for writing code
- Has the Vim tutor available to assist in learning features
- Keyboard-controlled, making for a steeper learning curve
- Syntax-highlighting and automatic indentation are turned off by default and must be turned on
- A free, powerful text editor available for all major platforms.
- Distribution includes a number of plugins to add commands.
- Has a built-in tutorial feature, allowing you to access help from within Vim.
Guide Review - Vim Text Editor
Using Vim is not easy. Compared to GUI text editors such as Notepad++ or TextMate, Vim has a much steeper learning curve. However, this is mainly due to the fact that everything in Vim is controlled with the keyboard. Though some GUI versions do exist, to use Vim effectively you still need to memorize all of the keyboard commands.
However, a good way to learn Vim is the Vim tutor. The tutor is available on the web or from within Vim by entering the :tutor command and pressing enter. Though you don't need to learn all of Vim's features, reading everything at least once to know the feature is there and what it does is helpful. For the features you use often, I'd recommend you make a cheatsheet until you can memorize them.
You'll need to make a few tweaks, too. Things such as syntax-highlighting and automatic indentation are provided in Vim but turned off by default. It's not that tough to turn them on, though. All you have to do is open your .vimrc configuration file and find and un-comment the following lines. (If the lines are not in the file, add them to the end of the file.) Once this is done, save and exit Vim with the :wq command.
syntax on if has("autocmd") filetype indent on endif
Vim has syntax highlighting. Keywords, comments and operators will all be colored, a powerful visual aid for reading code. When you try to edit the file, you'll find that if you start a new line, it will automatically indent to the level of the previous line. If you start a new block, it will automatically further indent lines until the end of the block.
Ruby scripts are usually "space indented." This means they don't use the tab character, but use two space characters instead. This has to be set up in Vim, by opening your .vimrc file and entering the following lines at the end of the file.
set sw=2 set sts=2