Make rails.vim Work: Compile VIM From Sources
Ever heard about rails.vim project? “Accept no imitations: rails.vim is the one true Vim plugin for syntax highlighing, easy navigation, and script invocation for all your Ruby on Rails applications, transparently and unobtrusively” says creator Tim Pope.
The very good “rails.vim” guide can be found here or just by reading project’s vimdoc here.
PROBLEM:
There is however one gotcha for Ubuntu Hardy Heron lovers (or other modern Linux distros). Using rails.vim would result in VIM “segmentation fault”crashes similar to:
Vim: Caught deadly signal ABRT Vim: Finished. Aborted
REASON:
This is due to the fact that a packaged VIM that comes from some Linux distros repositories has old patches.
SOLUTION:
One of possible solutions would be to download most current VIM sources from http://www.vim.org/sources.php and compile/install it manually. Below is how it is done on Ubuntu (but should be pretty similar on any Linux distro):
1. Get vim sources:
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2
(where ‘7.1′ is the current VIM version at the moment of writing)
2. Unpack it
tar -xvjf vim-7.1.tar.bz2
3. Install terminal libraries (vim needs them to compile correctly)
sudo apt-get install libncurses5-dev
4. Configure / Compile / Install
./configure --with-features=huge make sudo make install
5. Point your system to newly compiled VIM:
sudo rm /etc/alternatives/vi sudo rm /etc/alternatives/vim sudo rm /etc/alternatives/vimdiff sudo ln -s /usr/local/bin/vim /etc/alternatives/vi sudo ln -s /usr/local/bin/vim /etc/alternatives/vim sudo ln -s /usr/local/bin/vimdiff /etc/alternatives/vimdiff
DONE
howto linux rails ruby software technology tutorials ubuntuYou can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
August 2nd, 2008 at 20:44:21
Thanks
August 3rd, 2008 at 7:19:25
This is great thank you. However, would you know how to install the latest gVim as well?
August 3rd, 2008 at 11:55:18
welcome
Ramon,
This will install latest gvim as well into “/usr/local/bin/”, hence it should pick it up automatically:
user@host:~$ which gvimdiff
/usr/local/bin/gvimdiff
user@host:~$ which gvim
/usr/local/bin/gvim
in order to check that you have latest gvim installed, run gvim and in command mode type:
:version
that should tell you when vi (gvim) was compiled and who compiled it:
VIM - Vi IMproved 7.1 (2007 May 12, compiled Aug 2 2008 15:10:48)
Compiled by ramon@ubuntu-hh
in case you still want to make sure that everything is pointed to the latest g/vim do this:
user@host:~$ sudo rm /etc/alternatives/gvim
user@host:~$ sudo ln -s /usr/local/bin/gvim /etc/alternatives/gvim
user@host:~$ sudo rm /etc/alternatives/gvimdiff
user@host:~$ sudo ln -s /usr/local/bin/gvimdiff /etc/alternatives/gvimdiff
DONE
October 5th, 2008 at 15:11:22
Thank you very much. This was perfect
October 27th, 2008 at 15:44:55
Hi, what libraries do I need to get gvim to compile? I’ve got a fresh Ubuntu install and I can’t get any gui support.
October 28th, 2008 at 22:16:54
@squil,
Open the terminal and enter:
That should take care of gvim install for the fresh Ubuntu.
If you still need to compile it from sources (for whatever/above reason), follow instructions above. If you have any questions/difficulties, let me know,
– Toly
October 29th, 2008 at 3:19:36
Hi,
Thanks for your reply. I do need to compile it from source as the Ubuntu package I’m using doesn’t work with rails.vim plugin. I also followed the instructions above, but I keep getting ‘no GUI support’ during ./configure. Are there any specific libraries I need to install? I got gtk libraries and gtk-dev, but still no luck. Can you help me?
October 31st, 2008 at 17:12:33
@squil,
It seems like you have an older version of VIM that “./configure” is looking at. Look at your $PATH variable, and see if “/usr/local/bin” comes after “/usr/bin”, and if it does change your $PATH, so “./configure” will look inside the “/usr/local/bin” first.
– Toly
November 13th, 2008 at 8:38:06
thx, i’ve been looking for this for years, the missing link was libncurses5-dev
it’s a hell installing things from sources in ubuntu, i really hate it
November 16th, 2008 at 22:59:10
Hey, i followed your howto; vim compiled fine, except now i have a keyboard issue with arrow keys. Whenever i type one of the arrow key vim inserts one of the letter ABCD.
Any idea?
November 16th, 2008 at 23:11:49
Apparently this is a common bug on Ubuntu, where the fix is install the vim-full package… However this does not apply in case of compilation. What the does the “vim-full” means, is there a way to activate it with the manual compile?
November 17th, 2008 at 18:47:30
@ David,
Try two things:
:set nocompatibleAND / OR
Let me know if that helps,
– Toly