Friday, October 2, 2015

Re: Looking for a robust 'search for visual selection' implementation

This works for multi-line searches
where the contents are taken literally.
Best read in a monospace font to see the notes.

nnoremap * g*

" multi line search -- selection literal
" 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

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

Post a Comment