René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Using colors in vim or gvim | ||
In order to bring colors into a vim document, one must use syntax and
highlight. The syntax defines what gets colored while highlight
describes how it is colored.
Here are a few basic steps that show some minimal steps. As an example,
we want to highlight the word pizza with a green background. So,
we do a
:highlight MYGREEN guibg=green .
Then, we define the keyword pizza: :syntax keyword MYGREEN pizza
Now, whenever the word pizza is typed, it gets a green background.
Of course, one cannot be satisfied with that because you probably want to
color more generic words. The following example highlights four consecutive
digits:
:highlight MYBOLD gui=bold :syntax match /<d{4}>/ MYBOLD |