On May 16, 2:59 am, "John Beckett" <[email protected]> wrote: > Panciz wrote: > > with the * and # command it is possible to search (foward and > > backward) for the word nearest the cursor, is there a way to > > use an entire block of highlighted text as pattern for the search. > > http://vim.wikia.com/wiki/Search_for_visually_selected_text
Based on John's suggested link, I modified * for search forward. ""-----=-------=-------=-------=-------=-------=-------=-------= " multi line search selection literal (vi6.2 ok) :help c_<C-R> vmap * y/\V<C-R><C-R>=substitute(escape(@",'\/'),'\n','\ \n','g')<cr><cr> " ||| | | | | | | +flag g=all " ||| | | | | | +regex=<cr> " ||| | | | | +<cr> " ||| | | | +escape / " ||| | | +contents of register " ||| | +expression register " ||| +insert contents of expression register = LITERALLY " ||+"very nomagic", only \ is magic " |+search " +yank selected text into register " ""-----=-------=-------=-------=-------=-------=-------=-------= Sometimes I have regex strings in a file that I would like to use for searches. I did not need # to search backward, # has been redefined: ""-----=-------=-------=-------=-------=-------=-------=-------= " single line search selection regex vmap # y/<C-R><C-R>"<cr> ""-----=-------=-------=-------=-------=-------=-------=-------= -- 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
