Monday, August 6, 2012

Re: vim: comment regex

On Sunday, August 5, 2012 10:02:13 PM UTC-5, ping wrote:
> experts:
>
> how to comment a long regex?
>
> it looks normal line continuation doesn't work here -- I have to put
>
> everything in one line, which becomes painful as it goes long...
>
>
>
> syn region erxLog
>
> \start=/^\(\S\S\+.\{0,45}\S[#>%]\s*\S\+\|slot
>
> \d\d\=->\S\+\|->.\+\|\*-\*-\*-\*-\*-\)/
>
> \end=/^\(\S\+.\{0,45}\S[#>%]\|^[#>%]$\|->\|slot
>
> \d\d\=->\|\*-\*-\*-\*-\*-\)/me=s-1 fold
>

The only way I know of is to build a string and then use :exe on the string rather than giving the command directly, e.g.

let pattern='apples' " apples are healthy
let pattern.='\|bananas' " and bananas are delicious
exec 'syn match ILikeToEat /'.pattern.'/'

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

No comments: