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 --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 22 2016 23:01:25)

> sudo which 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
> sudo echo $TERM

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

Update: Under both root and my own user:

:echo $MYVIMRC

migrated from serverfault.com Jan 2 '17 at 14:01

This question came from our site for system and network administrators.

  • Does your and root's .vimrc file differ in any way? What if you start Vim with vim -u /dev/null and then manually go through the options in your .vimrc file one by one until you find the offending one? Also, I'm assuming vi and vim are the same executable, because you do say you ran sudo vi, not sudo vim ... – Kusalananda Jan 2 '17 at 18:00
  • Yes, vi and vim are the same. I ran it as vim just to be sure. When I run :echo $MYVIMRC, it returns /home/aaron/.vimrc in both cases – AaronM Jan 2 '17 at 18:39

Your Answer

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

Browse other questions tagged or ask your own question.