Ruby On Vim June 6th, 2007

Vim is my religion. Vim is true programmers editor. It can be extended. It has many features. Using vim make you looks like a true hacker. If vim is a weapon, it could be used for short distance fighting (like knife or sword). But you can use it to shoot somebody (as pistol). Don’t underestimate it. Snipper can use it to shoot the president of a country in distance of 400m. You can destroy the buildings full of enemy soldiers with vim (think bazooka). With hard works of a reasonable amount of specific people, you can use vim to destroy a planet (okay, I am drunk now). But you get the idea. You can find many scripts to extend vim. But someday you need to extend vim your self.

Ruby is my favorite programming language. Ruby is fun. Ruby makes programmers happy. So why not combine them? Extend vim with ruby. I will guide you to write simple vim plugin using ruby. But you need to be familiar with vim and ruby (just be familiar is enough, no need to be a ninja).

You need vim compiled with ruby support. If you get vim from default place (from Linux distro maybe), most likely you have ruby support in vim. But I think you need to install vim-ruby package or something like that to enable ruby support for default vim. If you want to compile vim from source, make sure you have ruby development header. Don’t forget to use —enable-rubyinterp option in configure step. You can check if your vim has ruby support or not with this vim command.

:echo has("ruby")
If you get 1, you are all set. If you get 0, you have to set up ruby support first for your vim. Read the rest of this entry