On 2012-07-29, Bee wrote: > escape / after \V > > :help \V > > Use of "\V" means that in the pattern after it only the backslash has > a special meaning. "very nomagic" > > I have a function: > > function! Visual2Highlight() > let @/ = '\c\V' . substitute(escape(@@,'/\'),'\n','\\n','g') > execute '3match User1 /' . @/ . '/' > endf > vnoremap <F12> y:call Visual2Highlight()<cr> > > If / is NOT included in escape(@@,'/\') it does NOT work. > > If I use the function on line(s) that have a / then I get an error: > Example: Visually select this whole line: > > " multi-line visual to /highlight > > Error detected while processing function Visual2Highlight: > line 2: > E488: Trailing characters: 3match User1 /\c\V" multi-line visual to / > highlight\n/ > > It looks like / still has special meaning. > What is happening?
In the 3match command, you are using / to delimit the pattern, so any / within the pattern will have to be escaped, otherwise the first one will terminate the pattern and the following characters will be seen as "trailing characters". Regards, Gary -- You received this message from the "vim_dev" 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
