1

I recently installed VIM 8.0 on my Ubuntu 14.04 machine. When I open vim, it outputs an error:

> vim ~/.vimrc
Error detected while processing /usr/local/share/vim/vim80/syntax/syncolor.vim:
line   36:
E254: Cannot allocate color Orange1
E254: Cannot allocate color Orange1
Press ENTER or type command to continue

When I hit enter, it opens without syntax highlighting (but with a colorscheme, the colors change slightly if I change :colorscheme to something different).

But if I run as root, it opens with syntax highlighting.

sudo vim ~/.vimrc

I assumed it was a permission issue, so I set syncolor.vim to be readable by all:

> ll /usr/local/share/vim/vim80/syntax/syncolor.vim 
-rwxrwxrwx 1 root root 4.0K Dec 22 23:29 /usr/local/share/vim/vim80/syntax/syncolor.vim

Still no luck. Then I wondered if vim was set to something different under root than under my user:

> which vim
/usr/local/bin/vim
> /usr/local/bin/vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 22 2016 23:01:25)


> sudo which vim
/usr/local/bin/vim
> sudo /usr/local/bin/vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 22 2016 23:01:25)

My next thought was that root's TERM was different:

> echo $TERM
xterm-256color
> sudo echo $TERM
xterm-256color

Both root and my own user are using the same .vimrc file:

echo $MYVIMRC
/home/aaron/.vimrc

I'm at a loss. What else could be different between my user and root that would cause colors not to load?

2
  • Well, I know this is old, but your tests for $VARIABLES are invalid. They are expanded before sudo is ran. Instead, you should test like sudo bash -c 'echo $VARIABLE'. (notice the single quotes) you can check with $PATH or $LOGNAME which are usually different between you and sudo.
    – dpb
    Commented Apr 26, 2018 at 18:35
  • Hi! I just saw this comment now. I will try that and see if it does the trick. Thanks!
    – AaronM
    Commented Jun 22, 2018 at 21:42

1 Answer 1

0

The problem is most likely 'defaults.vim' in your '$VIMRUNTIME' folder, which in this case would have likely meant.. /usr/local/share/vim/vim80/defaults.vim

I've just been trying to fix the same issue on OpenVMS with vim 8.1, and that turned out to be the cause - loading vim with vim -u [some garbage filename] forces vim to load without the system .vimrc, but also without the system defaults.vim

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .