2013-11-15 17:45, Bee skrev:
On Friday, November 15, 2013 1:42:07 AM UTC-8, Paolo Bolzoni wrote:
seldom I need to search specific part of text that are not simply the current
word (where * is handy). And I instinctively select the part visually, only to
notice I do not know how to search for it in the whole text.
Example, assuming the caret is on the beginning of the sequence I want to seek,
I tend to do:
vwwe
and I am stuck. Is there a way to search for what I have selected?
Thanks,
Paolo
Paolo
I have substuted my own function in place of *.
The following is best viewed in a mono-spaced font.
It works the same as the regular *
but also works with a selection, even a multiline selection.
Bill
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! :-)
/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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.