On 17/11/09 16:55, Jürgen Krämer wrote:
>
>
> Hi,
>
> Yogi wrote:
>>
>> I want to be able to highlight bold, italics, and underlined words in
>> a text file. My solution was to use
>>
>> hi QuickBold gui=bold
>> hi QuickItalic gui=italic
>> hi QuickUnderline gui=underline
>>
>> match QuickBold '\[\*\zs.\{-}\ze\*\]'
>> match QuickItalic '\[\/\zs.\{-}\ze\/\]'
>> match QuickUnderline '\[_\zs.\{-}\ze_\]'
>>
>> but it does not seem to work. Apparently, "match" can be used to match
>> [*only one*] group. So, in the above example, underlining works (since
>> it appears last), but bold and italics don't.
>>
>> Any ideas how I can do it? Do I need to write a syntax file for this?
>
> you can define up to 3 different matches by prefixing the match-command
> with numbers 1, 2, and 3, respectively:
>
>    hi QuickBold gui=bold
>    hi QuickItalic gui=italic
>    hi QuickUnderline gui=underline
>
>    1match QuickBold      /\*\zs.\{-}\ze\*/
>    2match QuickItalic    /\/\zs.\{-}\ze\//
>    3match QuickUnderline /_\zs.\{-}\ze_/

However, beware that :3match is already used by the matchparen plugin, 
so if you want to use it for another purpose you had better do

        :NoMatchParen

first (if already started), or

        :let loaded_matchparen = 1

(if in the vimrc).

>
> (I rewrote the patterns to use slashes because you version didn't work
> for me.)
>
> If you want more matches you can use the matchadd() function -- or you
> have to write a syntax file.
>
> Regards,
> Jürgen
>

Best regards,
Tony.
-- 
There is no TRUTH.  There is no REALITY.  There is no CONSISTENCY.
There are no ABSOLUTE STATEMENTS   I'm very probably wrong.

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to