Linux – I can’t get XFCE terminal to display VIM’s colorschemes

linuxterminalvimxfcexterm

That's what I have in my .bashrc

if [ -n "$DISPLAY" -a "$TERM" == "xterm" ]; then
    export TERM=xterm-256color
fi

In my .vimrc I have:

set t_Co=256

echo $TERM prints xterm-256color

tput colors prints 256

I've also runned a script called 256colors2.pl and all colors are printed correctly. Still what I see in my terminal is this (that's the "desert" theme):

desert

Also the colortest.vim file does not display properly:

colortest

Apparently it only shows the default color palette of my terminal.

Best Answer

You need to go to the xfce terminal preferences, click the Compatibility tab, and make sure the emulation setting is "xterm-256color" and not "xterm"

The basic reason for the issue can be found in this article: https://codeyarns.com/2015/03/18/how-to-set-term-to-xterm-256color/

Basically, you need to have VTE or GNOME based terminals set the term environment variable before the shell is invoked. The above settings will cause this to happen in the XFCE terminal

Related Question