Ubuntu – Why can’t vim find syntax.vim on the fresh Ubuntu installation

configurationsyntax highlightingUbuntuvim

I'm trying to make some basic customizations to vim. All I want is some syntax highlighting, etc. Basically, not just plain text.

My .vimrc file consists of 7 lines:

backspace=2
syntax on
filetype indent on
set autoindent
set number
colorscheme desert
set nobackup

Every time I launch vim, I get these errors and see no syntax highlighting:

E492: Not an editor command: backspace=2
E484: Can't open file /usr/share/vim/syntax/syntax.vim

The latter problem just might stem from the fact that I don't have a /usr/share/vim folder. I would have thought that this would have been created when I installed vim. So, what do I do now?

Best Answer

First things first, sit back, relax, and take a few deep breaths. Okay, relaxed now?

For the first error, you need:

set backspace=2

The second one I can only assume occurred becaue you're not using the standard vim that ships with Ubuntu, or your environment has become broken somehow. What you probably need to do is actually find the syntax file with something like:

find / -name syntax.vim 2>/dev/null

and then ensure that your VIMRUNTIME environment variable is set correctly for that (for example, if the file was located at /xyzzy/plugh/syntax/syntax.vim, then you would set the variable to be /xyzzy/plugh).

Related Question