0

Okey, the title definitely needs work, but you Vimmers out there, may already have a clue of what I'm aiming at.

I recently found myself using Vim's * function often (pressing the * key to fast forward search for some words). Is there a way to put the current visual selection (usually consisting of two or three words) into with * and then to use the * key to toggle through the buffer for it?

The question body is goona need some work too :-)

Rook
  • 60,248
  • 49
  • 165
  • 242

1 Answers1

1

You can use a command that comes with the help of vim, it's like:

:vmap X y/<C-R>"<CR>

What does it mean?

With some text selected in visual mode, press X and the map yanks it to the unnamed register (y), begins a search command (/), yanks the content of the unnamed register into the text to search (<C-R>") and begins the search with <CR>. After it you can use the common * to following terms.

Birei
  • 35,723
  • 2
  • 77
  • 82