Make rails.vim Work: Compile VIM From Sources

rails.vimEver 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.


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.


This is due to the fact that a packaged VIM that comes from some Linux distros repositories has old patches.


One of possible solutions would be to download most current VIM sources from 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:


(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
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



  1. This is great thank you. However, would you know how to install the latest gVim as well?

  2. welcome :)


    This will install latest gvim as well into “/usr/local/bin/”, hence it should pick it up automatically:

    user@host:~$ which gvimdiff
    user@host:~$ which gvim

    in order to check that you have latest gvim installed, run gvim and in command mode type:


    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 :)

  3. Thank you very much. This was perfect :)

  4. 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.

  5. @squil,

    Open the terminal and enter:

       $ sudo apt-get install vim-full

    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

  6. 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?

  7. @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

  8. 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

  9. 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?

  10. 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?

  11. @ David,

    Try two things:

        :set nocompatible

    AND / OR

        :set term=builtin_ansi

    Let me know if that helps,

    – Toly

tell me something...
  1. (required)
  2. (valid email - optional)
  3. Captcha
  4. (required)