Vim: copy a template from one file and find it in another

Suppose we opened two files A and B in mode vsplit. Now there is a template in p, and one wants to pull it out (switch the visual mode and yy) and look for it (typing /in command mode) in B. How to do this?

+3
source share
1 answer

You can use Ctrl+ R, and then ", to insert the contents of the default register into a command /or command :. If you did yank with yy, then the text will be in the default case, so that will be what you want.

If the text you want was entered in a register other than the default, then just use the letter or register number instead ", for example. Ctrl+ R, zto insert the contents of register z.

Find the documentation for the command line to CTRL-Rfor more information and special registers that can be used.

+6
source

All Articles