Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I seeing only 8 colors in terminal (xfce-terminal)?

I'm running Xubuntu 13.04 and I want to use Vim as my default editor for everything. I have downloaded many vim color schemas and tried them out, but all of them don't look like the official screenshot.

For example, vim's own color schema - desert should look like this:

enter image description here

But in my vim, many colors won't display, for example the background.

enter image description here

So this means a fighting with xfce's Terminal and I can't force it to use 256 colors. the command tput colors gives me 8.

At the same time the code for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done shows me nice colors. it seems i missed something. If I run

 **$ echo $TERM**

I get xterm. It should be 'xterm-256color'

When I try set term=xterm-256color and export TERM=xterm-256color

Then: echo $TERM

I get the message xterm-256color.

But after signout/signup, I'm still not getting the right colors in Vim. And I see the Xterm is changed to xterm again.

I added:

if $TERM == "xterm-256color" set t_Co=256 endif

and

t_Co=256

to my .vimrc file and it didn't seem to help. Then I customized the xterm entries; added this to ~/.Xdefaults:

 *customization: -color
 XTerm*termName: xterm-256color
Add this to ~/.xsession to apply to new terminals:

if [ -f $HOME/.Xdefaults ]; then
   xrdb -merge $HOME/.Xdefaults
fi

When I changed in preferences of terminal, emulate terminal environment, the 'xterm' to 'xterm-256color'

I get the message:

 '*** VTE ***: Failed to load terminal capabilities from '/etc/termcap' 

When I check /usr/share/vte/termcap/xterm, the file xterm-256color is missing. Same in folder xterm0.0. I tried to find this file on internet to download and put in the folder, but I couldn't find it.

This is driving me crazy the whole day... Have anyone suggestions?

like image 450
ReneFroger Avatar asked Oct 11 '13 21:10

ReneFroger


People also ask

How do I change the color of my terminal in Xfce?

Changing the color schemes To change the color scheme in Mousepad, go to Edit → Preferences, and from the View tab, select your preferred Colour scheme. To change the color scheme in the Xfce4 terminal emulator, go to Edit → Preferences, and in the Colors tab, use the Load Presets…

How do you know if terminal supports 256 colors?

To check if vim supports 256 colors, install xterm-color-table.

What is xterm color?

xterm-color describes an older branch of Xterm that supports eight colors. xterm-color is not recommended, since it describes a variant of Xterm that's less functional and that you're not likely to be using. Usually you'll want to use xterm , xterm-16color or xterm-256color .


1 Answers

Quick (Temporary) Way

Enter this whenever you open a new terminal:

export TERM=xterm-256color

Works for as long as the window is open.

Works-but-dirty Way

Append the line above to ~/.bashrc.

The problem with that, though, is that editing $TERM in .bashrc is a bad idea because doing that automatically makes any terminal using bash try to use it regardless of whether it actually supports 256 colors or not (like when SSH-ing or accessing the terminals with Ctrl+Alt+F1 to F6).

What I did, though is that since xfce4-terminal sets the $COLORTERM value to xfce4-terminal, I, instead appended the following to .bashrc:

if [ "$COLORTERM" == "xfce4-terminal" ] ; then
    export TERM=xterm-256color
fi

That way, the relevant $TERM edit only happens if you're using xfce4-terminal, which just sets it to xterm anyway (and changing the emulation environment results in that "VTE" message).

References:

  • https://bbs.archlinux.org/viewtopic.php?id=175581
  • http://vim.wikia.com/wiki/256_colors_in_vim#Comments
  • http://promberger.info/linux/2008/04/05/getting-256-color-support-working-for-mutt-in-xfce4-terminal/
  • http://docs.xfce.org/apps/terminal/getting-started
like image 69
maki57 Avatar answered Sep 23 '22 21:09

maki57