On Jul 31, 8:07 am, Karthick <[email protected]> wrote:
> On Jul 30, 4:05 pm, "J. Manuel Picaza" <[email protected]> wrote:> Hello
> everybody,
>
> > I am trying to write a function for searching all text marked in a
> > visual block.
>
> Also check :help visual-search though what you might be attempting
> could be different
>
> > the problem is when in the visual block there is something like:
> > variable="some text's function"
> > The block contains both " and ' so any attempt to assign the block to
> > a variable fails.
>
> I'm not sure how you access the contents of the visual selection.. one
> way is to yank it. If you are doing that, you can assign the block to
> a variable by doing:
> :let var=@"
Thanks a lot!
Now I can find any kind of text just selecting with the mouse and
pressing // (in the line of yy or dd)
The code for it is:
snoremap // <esc>gvy:let @/=escape(@",'\/$')<cr>
vnoremap // y:let @/=escape(@",'\/$')<cr>
""""""""" Before asking here (not fully functional)
"snoremap // <ESC>gvy:execute ':let @/ = "\\V\\c' . substitute
(substitute('<C-R>"','\\','\\\\\\\\','g'),'"','\\"','g') . '"'<cr>:set
hlsearch<cr>
"vnoremap // <ESC>gvy:execute ':let @/ = "\\V\\c' . substitute
(substitute('<C-R>"','\\','\\\\\\\\','g'),'"','\\"','g') . '"'<cr>:set
hlsearch<cr>
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---