When I try to open my .bashrc file. then it shows these lines:

Errordetected while processing /etc/vimrc:
line 45:
E848: Can't open file /usr/share/vim/vim70/syntax/syntax.vim
Press ENTER or type command to continue

When I go to the /etc/vimrc file , it shows syntax on line 45. I've installed the OS three times and it always shows the same error.

  • 1
    Would be nice to see the whole .vimrc. Can you make a gist or a pastebin? – Profpatsch Mar 15 '13 at 10:23
  • 3
    Does the file /usr/share/vim/vim70/syntax/syntax.vim exist? If so, is it readable? – Jenny D Mar 15 '13 at 10:27
  • No, it does not exist. – devsda Mar 15 '13 at 10:35

Your server is trying to use a file for lexical highlighting. The file does not exist at the place where vim is looking for it.

At this point, you can do any one of the following:

  • Remove the reference to syntax in /etc/vimrc
  • Look for the syntax file on your server (e.g. find / -name syntax.vim) and copy or symlink that file to the directory where vim is looking
  • download a syntax file, e.g. from vim.org
  • create a syntax file - there's documentation at vimdoc.sourceforge.net

Vim expects to find its installation files (eg help system, definitions for syntax highlighting) in a particular place but can run without many of them. It's possible that while you can run Vim, it cannot locate these installation files.

Vim will try several methods to locate these files but if you have a unusual installation then they won't be found.

If you can access the help system, read these topics: :help $VIM and :help $VIMRUNTIME. You'll likely not find them with your current configuration, therefore read versions on the Web, eg :help $VIM and :help $VIMRUNTIME.

I suspect that you can solve your problem by correctly setting one or both of the VIM and VIMRUNTIME environment variables.

You might discover that the vim binary and runtime files exist in disparate directory trees and that you'll need to hunt for the runtime files below some path, eg: find /path -type d -name 'vim[0-9]*'

An Example

I rely on a Vim instance that is bundled with the Sun Studio development package, which our SysAdmin has provided via a remote mount. The vim binary is located at /remote/sunstudio12/SUNWspro/contrib/vim/bin/vim (eg which vim) and the runtime files are located in /remote/sunstudio12/SUNWspro/contrib/vim/share/vim/vim63.

I had a similar problem to yours. Firstly, I tried exporting VIM=/remote/sunstudio12/SUNWspro/contrib/vim, but that didn't work. Separately, I tried exporting VIMRUNTIME=/remote/sunstudio12/SUNWspro/contrib/vim/share/vim/vim63, which works correctly (while VIM remains unset). VIMRUNTIME should point to a directory containing files such as menu.vim, scripts.vim and directories such as colors, doc, syntax etc (possibly version-dependant, YMMV).

I also modified my PATH to locate the vim binary, however, you can successfully run the binary already.


I revisited my shell environment settings for the above, and found that exporting VIM=/remote/sunstudio12/SUNWspro/contrib/vim/share/vim (and unsetting VIMRUNTIME) also worked -- my initial experiments with setting VIM were misguided. The location pointed to by VIM contains a directory, vim63, containing the run-time files that I need.

I still rely on PATH to locate the vim binary.


The missing file is not a syntax definition, it is the Vimscript implementation of the :syntax on command. Without it, there will be no syntax highlighting in Vim.

That file comes with Vim; your installation must have become corrupted. Try re-installing. Also, Vim 7.0 is from 2006 and very outdated. It should be possible to install the latest version 7.3; if you can't find a proper package for your distribution, it's also not very difficult to compile (e.g. from the Mercurial sources) on Linux.


Check in your .vimrc that you aren't specifying where vim should look for syntax.vim. eg:

set rtp+=/usr/local/vim/
set rtp+=/usr/local/vim/runtime/
let $VIMRUNTIME="/usr/local/vim/runtime/"

If you copied your .vimrc from macos you may have something like the above, used to work around the conflict between Apple-installed and Brew-installed vim.


If you did not install vim-runtime, you will get such error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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