Vim Tips Wiki
Register
Advertisement
Tip 126 Printable Monobook Previous Next

created October 3, 2001 · complexity basic · author Charles E. Campbell, Jr. · version 6.0


Having problems setting up your syntax highlighting because everything is coming up in bold?

You're probably using an 8 color xterm and setting up highlighting lines such as hi Normal ... ctermfg=green . The solution: use numbers! 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, and 7=white. Vim tries to use "bright" colors when its given names (because Windoz machines prefer to use dim text unless its been made bold).

Read more about it at :help highlight-ctermfg.

Comments[]

This works ok, but a more portable (and more predictable) way is to use the dark color names. i.e. use DarkBlue instead of Blue, Gray instead of White, etc. See :help cterm-colors.

If you are using a recent xterm try putting this in your .vimrc:

if &term =~ "xterm"
  " don't do this if you have 8-color xterms
  set term=xterm-16color
endif

And you will get the non-bolded versions of those colors (which means you have 16 colors to work with).

How many colors does my xterm support?[]

You can find out how many colors your xterm has by running

strings `which xterm` | grep color[0-9]

(and maybe sort it someway). The highest value plus one is the number of colors you have. So, if you find that this is 256, then set

set term=xterm-256color

instead.


Advertisement