[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Colours in VIM



Raj Kiran Grandhi wrote:
Pantor wrote:
Hi lads,

is it possible to make coloured text in VIM?
For example: "This sentence is in red color. This sentence is in black color." The first should be in red.

For colors and fancy formatting, something like openoffice would be more suited. VIM is a text editor. You can ask it to display text colored according to some predefined syntax, but not arbitrarily.


Actually, you can pretty much to anything you want, so I think
"arbitrary" is an accurate description.  You'll want to read
the help pages within vim for details, but if you want to have
the word "red" appear in red while the word "blue" appears
in blue, one way to do it is to put the following in
~/.vim/syntax/foo.vim:

syn match red "red"
syn match blue "blue"
hi red ctermfg=red
hi blue ctermfg=blue

Now, either in your .vimrc or by hand, execute (from within vim):
set syntax=foo

(The ctermfg refers to the console, (cterm == color term).  If
you are running gvim, you'll probably want to replace ctermfg with
guifg)



Reply to: