Tien Pham wrote:
Hi all

Is there anyway to change the background colour, font colour and to convert normal font to bold font just for a few words in VIM files?

I have a large file with many different sections and headings. I have been trying to find a way to make some headings or some notes standing out from the rest of the text by using different colours or different font sizes but I could find these things from the help command. I would appreciate if someone show me how to do it or tell me it cannot be done in VIM so that I can stop searching for my solution.

Many thanks
tien


Different font sizes are not possible. In Vim, all printable characters must be exactly the same height and width, with the exception of East-Asian "wide" characters, which must be exactly the same height and exactly twice the width of ASCII (or other "narrow") characters.

Different colours, as well as bold and (in terminals which support them) underlined or italic, are possible using syntax highlighting. For instance, in HTML files, any combination of <b>, <i> and <u> tags produces the corresponding combination of bold, italic and/or underlined text in gvim. Similarly, in help, the words "Note" and (IIRC) "TODO" are highlighted in a different colour than the rest (in gvim, usually black on yellow).

The commands :match, :2match and :3match (the latter is used for bracket matching and only the former exists prior to version 7) allow setting different bg/fg colours for text which matches a certain regular expression.

See
        :help syntax.txt
        :help :match


Best regards,
Tony.
--
... Our second completely true news item was sent to me by Mr. H. Boyce
Connell Jr. of Atlanta, Ga., where he is involved in a law firm.  One
thing I like about the South is, folks there care about tradition.  If
somebody gets handed a name like "H. Boyce," he hangs on to it, puts it
on his legal stationery, even passes it to his son, rather than do what
a lesser person would do, such as get it changed or kill himself.
                -- Dave Barry, "This Column is Nothing but the Truth!"

Reply via email to