Suppose we’ve opened two files A and B in vsplit mode. Now there is a pattern p in A, and one wants to yank it (switch visual mode and yy) and search for it (via typing / in command mode) in B. How does one accomplish this?
Suppose we’ve opened two files A and B in vsplit mode. Now there is
Share
You can use Ctrl + R followed by " to paste the contents of the default register into a
/search or a:command. If you’ve done the yank usingyythen the text will be in the default register so this will be what you want.If the text you want has been yanked into a register other than the default then just use the register letter or number in place of the " e.g. Ctrl + R, z to paste the contents of register z.
Search down the command line documentation for
CTRL-Rfor some more details and special registers that can be used.