How to set a custom color to folded highlighting in .vimrc (for use with putty)

The cterm in ctermbg is short for “color terminal”. It is used to define the background color when Vim runs in a terminal emulator and can only accept named colors like grey or cyan or color numbers like 7. Hexadecimal values only work in GVim/MacVim and must be used with guibg/guifg like that:

hi Folded guibg=#A0A0A0

In your shell, do $ echo $TERM: it should return something like xterm, screen, xterm-256color or some variants.

If you run Vim in a terminal emulator that can’t display more than 8/16 colors ($TERM doesn’t contain 256color), you won’t be able to use a different shade of grey unless you define your own palette in your terminal emulator.

It should look like this:

hi Folded ctermbg=7

or like that:

hi Folded ctermbg=grey

If your terminal emulator advertises itself as “256 colors ready” ($TERM contains 256color), you are able to use any color in this chart as long as you use its number (242) and not its hexadecimal value.

It should look like this:

hi Folded ctermbg=242

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)