Vim Tips Wiki

Syntax highlighting in xterm

Revision as of 08:30, September 28, 2008 by JohnBot (Talk | contribs)

1,619pages on
this wiki
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.


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

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

Around Wikia's network

Random Wiki