vim: comment regex

6 messages
Open this post in threaded view
|
Report Content as Inappropriate

vim: comment regex

 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 regards ping -- 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
Open this post in threaded view
|
Report Content as Inappropriate

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
Open this post in threaded view
|
Report Content as Inappropriate

Re: vim: comment regex

 On Aug 6, 8:48 am, Ben Fritz <[hidden email]> wrote: > let pattern='apples'      " apples are healthy > let pattern.='\|bananas'  " and bananas are delicious These do the same thing: let @/ = @/ . pad[c] let @/ .= pad[c] Is there an advantage (speed, space) to use one rather the other? Bill -- 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