2

I am very new to vim. I know there's a lot of copy-pasting issues. I kind of like the vim's different buffer idea, but sometimes I have to work with a big text file and search for different words.

When searching for a word I press Esc and then write /search_keyword. But while starting a search by pressing /, I cannot paste my copied text from visual mode that I 'yanked' with y.

How can I paste a keyword while searching in vim?

2

You may be able to simply press * to search on the current word, assuming what * does is appropriate.

Otherwise assuming the default yank buffer, type /<C-r>0 which is slash to search, control+r, zero which should insert the contents of the 0 register. If you've yanked to some other register that could be used instead of 0.

  • It says, E486: Pattern not found: <C-r>0. It actually searches for exact word <C-r>0 in the text not the value of register 0 @thrig – Maruf Apr 19 '18 at 14:20
  • Did you hold down the control key and then press the r key? – thrig Apr 19 '18 at 15:30
  • 1
    No I didn't. Thanks for the help. it works. – Maruf Apr 20 '18 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.