Friday, July 13, 2018

Re: Syntax matching question(s)

Hi,

Robert schrieb am 13.07.2018 um 15:29:
> On Friday, July 13, 2018 at 3:05:03 AM UTC-4, Lifepillar wrote:
>> On 13/07/2018 06:37, Robert wrote:
>>> On Thursday, July 12, 2018 at 10:51:40 PM UTC-4, Robert wrote:
>>>> I am creating a vim syntax file for GNU Rec as an exercise in creating a new syntax file.
>>>>
>>>> The things that I need colored are:
>>>>
>>>> %word:
>>>> +
>>>> word:
>>>> # comment
>>> […]
>>> Had a late work night so did this:
>>>
>>> syntax match recField "\v^\w+:\s"
>>> syntax match recPlus "^+\s"
>>> syntax match recComment "^#.*"
>>>
>>> syntax region recDesc start="^%" end=":" contains=recField
>>>
>>> Everything works. Are those "optimal"?
>>
>> According to `:h syn-pattern`, syntax patterns are always interpreted
>> as if 'magic' is on, so \v can be removed.
>>
>>
>> Life.
>
> If I take off the \v it breaks. So there is something wrong with how I am doing it.
>
> --
> Bob
>

"\v" means "very magic", not "magic". By removing "\v", the "+" in your first pattern
is taken literally, not as a quantifier.

Regards,
Jürgen

--
~
~
~
:wq

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