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?

1 Answer 1

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.

3
  • 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
    Commented Apr 19, 2018 at 14:20
  • Did you hold down the control key and then press the r key?
    – thrig
    Commented Apr 19, 2018 at 15:30
  • 1
    No I didn't. Thanks for the help. it works.
    – Maruf
    Commented Apr 20, 2018 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .