Friday, July 27, 2012

Re: :match by visual

Tim Chase wrote:
> On 07/27/12 22:06, Bee wrote:
> > How to use a visual selection to highlight with :match?
>
> While I don't have an immediate answer, I'd likely start with[1] and
> enhance it to create a :match expression which would then be :exec'ed.
>
> -tim
>
> [1]
> http://vim.wikia.com/wiki/Search_for_visually_selected_text

This is the multi-line search I wrote.
I will try the search part in 2match.
Oh...? Is it possible to just use the map '*' in the 2match?

" multi line search -- selection is literal
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 or @"
" '''''' ||| | | | | +{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

No comments: