vim colorschemes not changing background color

后端 未结 11 1827
北恋
北恋 2021-01-30 08:43

I try to apply various color schemes in vim that I have seen on the net. Whatever scheme I choose, the background remains white, even though screenshots of the applied scheme sh

11条回答
  •  别那么骄傲
    2021-01-30 09:16

    I had the same problem and found out that the answer to this question is actually threefold, where fixing only two of the three isn't enough. You'll need to have:

    1. 256-color support in your terminal - Putty with default settings does have this

    2. Vim has to recognize that the terminal is 256-color capable: "set t_Co=256" in your .vimrc will do it

    3. The color scheme needs to have support for color terminals with ctermbg and ctermfg attributes for highlights, not just the gui*-versions. http://www.vim.org/scripts/script.php?script_id=2682 should be able to provide these automatically, and CSApprox I'm using most definitely does, but requires either +gui -compiled Vim or a recent enough Vim version (7.3 or newer).

    The third one seems to be the most commonly missed requirement. I wrote a short piece on my own fumblings on this subject just this morning: http://codeandlife.com/2013/09/22/vim-colorschemes-with-putty-aka-gui-vs-xterm-color256/

    Final gotcha that happened to me while trying different settings was that when the colors did work, only areas of screen with text had the proper background color. Re-checking Putty Terminal setting "Use background colour to erase screen" fixed that final issue for me.

提交回复
热议问题