Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I upgraded my ubuntu to 11.04 and my gvim got all messed up. I am basically starting from scratch and need some help. Upon recommendation, I am starting to move everything related to vim (plugins and vimrc) into /usr/share/vim/vimfiles

gvimrc (file)
vimrc (file)
vimrc.dpkg-old (file)
vimrc.tiny (file)

I also have a .vimrc file in /home/laptop/.vimrc This file actually contains the settings/mappings that I've added

:set runtimepath fetches:

runtimepath=~/.vim, /usr/share/vim/vimfiles/vimfiles, 
/usr/share/vim/vimfiles, /usr/share/vim/vimfiles/vimfiles/after,

I have no folder like the one mentioned above /usr/share/vim/vimfiles/vimfiles

Questions: Why are there two vimrc's? should I swap contents of /usr/share/vim/vimfiles/vimrc with /home/laptop/.vimrc?


Error detected while processing /home/laptop/.vimrc
line 6
E484: Can't open file /usr/share/vim/syntax/syntax.vim

Line 6 is:

syntax on

my /usr/share/vim/vimfiles/syntax originally only contained snippet.vim, however, the /usr/share/vim/vim73/syntax folder contained many many other files. like gdb.vim, jsp.vim, groovy.vim, libao.vim...etc (more than 60 files)

so I copied all of those files to /usr/share/vim/vimfiles/syntax but still error is there

how can I get back my syntax highlighting?


  • had vim73_backup and now changed it back to /user/share/vim/vim73
  • :set rtp? does not have vim73 (as shown above)
  • :echo $VIM $VIMRUNTIME shows /usr/share/vim/vimfiles /usr/share/vim/vimfiles since this is do I get vim73 here?
share|improve this question
Thanks for getting that information. Your 'runtimepath' explains why your syntax on command was not working and why your sudo ln -s ... got it working. :help $VIMRUNTIME explains why it is set to the same as $VIM. :help $VIM explains how $VIM is set, but I can't tell from the information we've seen so far how it got set to /usr/share/vim/vimfiles. That's wrong. Given the other information you've given, your $VIM should be /usr/share/vim. Did you set $VIM yourself? What happens if you start vim as VIM= vim -u NONE then execute :echo $VIM? – garyjohn May 13 '11 at 4:40
up vote 5 down vote accepted
  • There is no reason to copy the files in /usr/share/vim/vim73 anywhere else. Your gvim already knows about those files and sources them when needed. You should remove from /usr/share/vim/vimfiles any files you copied there unchanged from /usr/share/vim/vim73.
  • Vim looks for runtime files (e.g., syntax files) in several places. These places are specified in the 'runtimepath' ('rtp' for short) option. You can read more about this in

    :help rtp

    You can see the current value of 'rtp' by executing

    :set rtp?

    As you can see from that, Vim already looks in ~/.vim, /usr/share/vim/vimfiles and a few other places as well as /usr/share/vim/vim73.
  • You need to find out why you are getting that error message at line 6 because the :syntax on command should not be looking for syntax/syntax.vim in /usr/share/vim/. That suggests that your $VIM and/or $VIMRUNTIME variables are messed up. Try executing

    :echo $VIM $VIMRUNTIME

    The result should be /usr/share/vim /usr/share/vim/vim73.
  • In addition to what benizi wrote (as I was writing this), you can find out about the various vimrcs on your system by reading

    :help vimrc

    You can also see where your vim is looking for its vimrcs by executing


    and you can see what files your vim has actually sourced by executing


All of that is probably not enough to completely fix your installation, but it will be a good start towards finding out what's broken and understanding where various files should go. We can go from there to get it all working properly.

share|improve this answer
please see my updates relative to your answer. thanks for working with me on this – Omnipresent May 13 '11 at 4:01
adding following to my .vimrc mad everything dandy.:let &runtimepath.=',/usr/share/vim/vim73' :let $VIMRUNTIME = "/usr/share/vim/vim73" plus the things you suggested ofcourse – Omnipresent May 13 '11 at 4:13
I looked at your updates and left a comment below them. It makes sense that these changes got it working, but as I wrote above, the fundamental problem is that your $VIM has somehow been set incorrectly. – garyjohn May 13 '11 at 4:48

You appear to be misinterpreting the suggestion in the question you linked.

Don't put anything in the globally shared /usr/share/vim/(anything) directories. As you discovered too late, it may well be overwritten when you update Vim.

Instead, put custom files in directories under a directory called .vim in your home directory. So, if you had a custom /usr/share/vim/vim72/syntax/gdb.vim file, put that in $HOME/.vim/syntax/gdb.vim. If you have a custom colorscheme, put it in $HOME/.vim/colors/name-of-scheme.vim.

To directly answer the question you asked, though, here are the purposes of the various vimrcs you've mentioned:

    .vimrc            - your personal .vimrc (won't be touched on upgrade, etc.)
     vimrc            - systemwide `vimrc` (affects all users on the system)
     vimrc.dpkg-old   - possibly your pre-upgrade modified version
     vimrc.tiny       - systemwide `vimrc` for the 'tiny' version of Vim
share|improve this answer
got it. i'll move everything to ~/.vim/ once I have this syntax highlighting issue resolved. any thoughts on that? – Omnipresent May 12 '11 at 19:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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