Monday, January 5, 2015

Re: how to display different color in vi

skyworld wrote:
> Hi John,
>
> thanks for your help. I have tried several times, but always failed.
>
> 1. I first tried to set "abc" in my file to be red as:
>
> :match abc /\<yellow\>/
>
> the system seems to be idle and there is no response.
>
> 2. I checked help with "match" command and tried its example:
>
> :highlight abc ctermbg=green guibg=green
> :match abc /\<red\>/
>
> still there is no reponse.
>
> could you give me some timps? thanks.
>
* its :match {group} /{pattern}/
(try using :help :match)

I seriously doubt that you've set up a highlighting group by the name
of "abc" if, in fact, that's what you tried. Try using something
sensible; say :match Error /\<yellow\>/ . Its not likely to be yellow,
though, but it'll give you the idea.
To set up color groups (red, yellow, ...), here's an example:

hi Yellow start= [m [33m stop= [m [32m
cterm=NONE ctermfg=14 guifg=yellow guibg=navyblue

With that, you could use :match Yellow /\<yellow\>/

* Its possible your vim does not support highlighting; for example,
perhaps not if its the tiny build. If the above doesn't work, then use

:version

Under "Compiled by..." is a line that will say
[Huge|Big|Normal|Small|Tiny] version..."

That command will tell you/us what you've got.

* You could try http://www.drchip.org/astronaut/vim/index.html#HIGHLIGHT
and get the highlight.vim plugin. Place cursor over something and press
"*" on the numeric keypad to get that something highlighted.

Regards,
Chip Campbell


--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: