On Fri, Nov 15, 2013 at 9:56 PM, tooth pik <toothp...@gmail.com> wrote: > On Fri, Nov 15, 2013 at 04:44:50PM +0100, Paolo Bolzoni wrote: >> Dear list, >> 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? > > there's probably a quicker/better way but what occurs to me is that you > could make a two step process out of it -- you already know the first > step, specifically how to visually select your desired text > > the second step would be to yank it with the 'y' command > > for your locate then you'd start with the '/', and then CTRL-R followed > by an asterisk will paste what you previously yanked after the '/' > > @* is the default register for yanks and puts > > if you have several strings you search for frequently you could yank > each into a named register and paste them as desired after your '/' > > see > > :help / > :help y > :help i_CTRL-R > > for more details (:help may be abbreviated :h) You can combine these into a vmap,
:vmap * y/<C-R>"<CR> Then after visual selection press '*' like usual for searching for visual text. -- -- 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.