2013-11-15 22:54, Gary Johnson skrev:
> On 2013-11-15, BPJ wrote:
>> 2013-11-15 17:45, Bee skrev:
>
>>> nnoremap * g*
>>> " multi line search -- selection literal :help c_<C-R>
>>> " substitute({expr}, {pat}, {sub}, {flags})
>>> vnoremap * y/\c\V<C-R><C-R>=substitute(escape(@@,'/\'),'\n','\\n','g')<cr><cr>
>>> " '''''' ||| | | | | | | | | | +{flags} g=all
>>> " '''''' ||| | | | | | | | | +{sub}
>>> " '''''' ||| | | | | | | | +{pat}
>>> " '''''' ||| | | | | | | +chars to escape
>>> " '''''' ||| | | | | | +contents of unnamed register
>>> " '''''' ||| | | | | +{expr}
>>> " '''''' ||| | | | +expression register
>>> " '''''' ||| | | +contents of register LITERALLY
>>> " '''''' ||| | +contents of register
>>> " '''''' ||| +VERY nomagic, only \ is magic
>>> " '''''' ||+ignore case
>>> " '''''' |+search
>>> " '''''' +yank selected into unnamed register
>>>
>>
>> I don't get the idea with the substitute(); would someone please
>> enlighten me? I speak only pidgin vimscript! :-)
>
> Since you are searching for a literal string, you want all the
> characters in that string to represent themselves and not be
> interpreted specially. For example, if the string contains an
> asterisk, you want that asterisk to be treated as a literal
> asterisk, not as zero or more occurrences of the preceding atom.
>
> The substitute() is there to escape any characters having special
> meaning in a search string so that they are treated as their literal
> forms.
Of course, but why is '\n' singled out for special treatment?
/bpj
--
--
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/groups/opt_out.
Friday, November 15, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment