Chinaunix首页 | 论坛 | 博客
  • 博客访问: 380533
  • 博文数量: 124
  • 博客积分: 30
  • 博客等级: 民兵
  • 技术积分: 11
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-29 22:22
文章分类

全部博文(124)

文章存档

2016年(8)

2015年(52)

2014年(53)

2013年(11)

分类: LINUX

2014-12-16 11:31:16

On 30/05/08 05:50, googler wrote:
> On May 27, 7:49 pm, Tony Mechelynck
> wrote:
>> On 28/05/08 02:43, Tony Mechelynck wrote:
>>
>>
>>
>>
>>
>>> On 24/05/08 20:59, googler wrote:
>>>> I would like to search for a particular string, say "abcd" and have
>>>> their occurences colored with red. Next I would like to search for
>>>> another string, say "wxyz" and have their occurences colored with
>>>> another color, say yellow. After the second pattern is found, the
>>>> first pattern should still remain colored. How can this be done in
>>>> vim? Thanks.
>>> :help :match
>>> :help :2match
>>> :help :3match
>>> :help matchadd()
>>> :help matchdelete()
>>> :help clearmatches()
>>> Note: The latest search pattern is in "register slash", so you can use
>>> :match ^R/
>>> (where ^R means "hit Ctrl-R) to "remember" the currently highlighted
>>> search before doing a new search. (Similarly with :2match but beware
>>> that :3match is used by bracket matching).
>>> Best regards,
>>> Tony.

>> Oops! That should have been
>>
>> :match /^R//
>>
>> Best regards,
>> Tony.
>> --

>
> On doing :match /^R// , I get "E28: No such highlight group name: /
> abcd/". Is there anything else I need to set? Thanks.


Looks like I was low on black tea when I made these previous posts:
hypotheinaemia is one of the main causes of erroneous posts with me.

Well: between the ":match" command-name and the /pattern/ you need the
name of a highlight group. For the same colors as the current search
pattern use

:match Search /^R//

For a red abckground as when syntax errors are found, use

:match Error /^R//

etc.

To see all the highlight groups currently defined in your Vim session
and how they are colored, use

:hi

Best regards,
Tony.
--
DENNIS: Oh, very nice. King, eh! I expect you've got a palace and fine
clothes and courtiers and plenty of food. And how d'you get
that? By
exploiting the workers! By hanging on to outdated imperialist dogma
which perpetuates the social and economic differences in our
society!
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
阅读(1578) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~