Friday, September 24, 2010

Re: How to highlight different keywords with different colors?

robert song wrote:
> Hi, everyone.
>
> Sometimes it's useful to display different keywords in different
> colors, here I can use * to highlight the word under cursor, but how
> to highlight the other keywords in some other colors at the same time ?

Have you tried Txtfmt (The Vim Highlighter)?

http://www.vim.org/scripts/script.php?script_id=2208

It's a token-based highlighter that lets you set the
foreground/background color, as well as the format attributes (bold,
underline, italic, etc...) of arbitrary text regions. Highlighting is
accomplished with tokens inserted by intuitive mappings, and as of Vim
7.3 (and Txtfmt 2.4), the tokens are *completely* concealed, so they
don't change the appearance of the document. (Before the "conceal"
feature was added to Vim, each token looked like a single space.)

Note that the 3 types of tokens (fg color, bg color, format) are
"orthogonal", so the same piece of text could be (e.g.) bold-italic, red
text on blue background. Of course, if you want to change foreground
color only, you can do that too. In fact you can disable colors
selectively to avoid creating highlight regions for
foreground/background colors you don't need. The fg/bg colors are
independently configurable with options, and you can enable up to 8 of each.

Sincerely,
Brett Stahlman

>
> Best Wishes,
> robert
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: