A server only has old versions of vim available in the repo, so I compile and run vim from my ~.

Starting vim it complains

line    2:
E484: Can't open file /usr/local/share/vim/syntax/syntax.vim

Where line 2 is where I have syntax on. This is obviously caused by the file not being present on the system. Setting let $VIMRUNTIME="/home/[user]/vim74/runtime/" makes the error go away, however I still get no syntax highlightning what so ever.

I've checked that /home/[user]/vim74/runtime/" has a syntax directory containing hundreds of [language].vim files.

I've tried commenting out the rest of my settings to make sure I have nothing else interfering.

What am I missing?

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar  6 2015 15:34:54)
  • IIRC, to install on custom directory, when you ./configure, you need to add --prefix=/home/[user]. Or maybe --prefix=/home/[user]/vim74.
    – tivn
    May 7, 2015 at 9:04
  • 2
    Or try with let $VIMRUNTIME="/home/[user]/vim74/" (without runtime ending).
    – tivn
    May 7, 2015 at 9:20
  • @tivn Naively I was trying to run with the runtime as it was in the source. I had never run make install (because I wanted to keep everything in ~). configure with a prefix and a make install did resolve the issue. If you want to post that as an answer, I'll accept it.
    – user50849
    May 7, 2015 at 9:26
  • ok, I will write as answer
    – tivn
    May 7, 2015 at 9:32

1 Answer 1


When you compile Vim source code and would like to install it on custom directory, this directory can be specified with --prefix option to the ./configure command. Usually I will go as follows:

 ./configure --with-features=huge --prefix=$HOME/local

After this, proceed with make and then make install. This will install the Vim binaries under subdirectory bin, and also manual pages under subdirectory share/man. These path can then be added to your PATH and MANPATH respectively.

Alternatively, assuming Vim source code is extracted into $HOME/vim74, the --prefix and make install may be omitted, if you specify the following in your .vimrc. Please note that this is only based on experiment so it is not recommended -- something may break.

 let $VIM         = $HOME . "/vim74"    
 let $VIMRUNTIME  = $HOME . "/vim74/runtime"
 set runtimepath^=$VIMRUNTIME           
 set helpfile=$VIMRUNTIME/doc/help.txt  
 syntax on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.