简体   繁体   中英

How do I get Vim colorschemes to work in gnome-terminal?

I have added this to .vimrc

set t_Co=256

That did not seem to have an effect.

I am using the "wombat.vim" color scheme from the vim.org website. This works fine in vim-gnome, the gui version. I have tried other color schemes and some work and some do not. If gnome-terminal will not work with the color schemes is there a terminal that will?

You need to enable 256-color support.

To do that, you need to put the following line in your ~/.bashrc , ~/.bash_profile , or ~/.profile file:

export TERM="gnome-256color"

The wombat colorscheme doesn't define colors for anything other than the gui. You can use the CSApprox plugin to allow using gui-only colorschemes in terminal vim.

Of course, once you do that there's still the issue of gnome-terminal not specifying the right $TERM for itself, so you have to either

  • Put code in your vimrc to try and detect when you're using gnome-terminal and only then manually set t_Co. CSApprox's documentation has an example.

  • Put code in your shell init file to try and detect when you're using gnome-terminal and only then manually set $TERM to a proper value

  • Convince Gnome upstream to fix the bug that's been sitting in their tracker for years to either allow users to set a proper $TERM (without having to edit the source and recompile) or to set it properly in the first place

    • It looks like they may finally be getting around to the first option and making it configurable via gconf/gsettings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM