Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
Would be nice to see the whole .vimrc. Can you make a gist or a pastebin? –  Profpatsch Mar 15 '13 at 10:23
2  
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. –  devnull Mar 15 '13 at 10:35
add comment

3 Answers

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.