Posts Tagged ‘VIM’

Getting Started With VIM

Wednesday, January 3rd, 2007

I’m still following the course over at LinuxBasics.org (and I’m waaaay behind at the moment). Chapter 6 is all about editors, and specifically the Vim editor. So for a least the next few posts, I’ll be composing in Vim and then pasting into WordPress.

Vim is the editor I’ve been forcing myself to use since jumping into the Linux ring. I chose it because I had heard of it before, I had actually used a GUI version of it in Windows for a while to maintain a Windrop IRC bot, and because everything I had read online made it clear that Vim was a very common and powerful UNIX editor.

There are tons of sweet commands in Vim that allow you to keep your fingers on the keyboard at all times. IMO, much preferable to mousing around an editor (even when I couldn’t type, I still found the keyboard faster). The commands do (of course) require a little practice to really nail down. The good news is that there’s an extremely simple to follow tutor built into the program. To run it, simply enter vimtutor at the command line and follow the on-screen instructions. I did find this tutor back when I started using Vim, I went through it once to collect enough information to make using the editor bearable, now I’m actually taking some time to get this down. Unless you’re an elephant, you’ll probably need to run the tutor a few times.

I’ve re-read the last two paragraphs, it almost sounds like I dislike using Vim. That couldn’t be further from the truth. It’s got a learning curve to it, it requires some thought in the beginning and (fortunately) that eventually leads to muscle memory. It was a moderately tough road at the start. So indeed, in the beginning I had to force myself to use it and at times it was as frustrating as hell. That ends, and I’m very comfortable using it on a daily basis now (I admit that I’m still looking up commands from time to time). The more you use it the better it gets. :)

Whatever you do, don’t go starting up Vim without (at the very least) going through the tutor or checking out some online tutorials. One of the things that make it such a powerful editor is that it has two modes, command and input. When you first launch it, you’re in command mode. Unless you happen to enter an i, a or o as the first character, you’re going to find yourself a little confused and probably annoyed.

Vim is certainly worth snuggling up to if you want to hone some of your skills. If you’ve been exploring your system, you know that almost every configuration file is comprised of plain text and you need an editor to make changes to them. Since you’ll find Vim on just about any distro, you’ll want this weapon in your arsenal.

Note: If you’re using Edgy, perform a sudo apt-get install vim before getting started, it seems that Ubuntu defaulted to Vi (the inspiration for Vim) and IMO, it’s just a bit more difficult get used to.

For more help with Vim check out the links below:

*http://www.apmaths.uwo.ca/~xli/vim/vim_tutorial.html

*http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html (neat cheat sheet)