On Tue, 25 Apr 2006, Suresh Govindachar wrote:


Hello,

 By default, * searches for words:  /\<stuff_below_cursor\>
 but I would like it to search for strings:  /stuff_below_cursor
 One way is to use the following

       map * yiw:let @/[EMAIL PROTECTED]<cr>

 Is there a better way? ("/yiw didn't work.)

I found this somewhere in Vim tips:

"visual search
vnoremap *           
y/\V<C-r>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
vnoremap <kMultiply> 
y/\V<C-r>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
vnoremap #           
y?\V<C-r>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>

HTH :)
--
Gerald

Reply via email to