Question

I have copied a word to search from the file.

Is there a command to paste that word in command-line mode.

For eg. I have copied the word 'static' from the code below in default register and I want to paste that in command-line mode, as below

/static

1275 static const struct of_device_id omap_mcspi_of_match[] = {
1276         {
1277                 .compatible = "ti,omap2-mcspi",
1278                 .data = &omap2_pdata,
1279         },
1280         {
1281                 .compatible = "ti,omap4-mcspi",
1282                 .data = &omap4_pdata,
1283         },
1284         { },
1285 };
Was it helpful?

Solution

While in either command mode or in search mode, type Ctrl+R" to paste from the default register. That is, type Ctrl+R, release it and then type ".

For any other named register, you can just to Ctrl+R followed by the name of the register, like a or b.

Alternately, if you enter search mode using the command q/ instead of just /, you can simply use p to paste, the same way you would in a normal buffer.

OTHER TIPS

There are a couple of ways to do this.

  • Check :h c_^r. On the command-line you can say /<C-R>" to copy the contents of the default register " and it will get converted to /static
  • Alternately, a more convenient way (in most cases) is to use :h c_^r^w to copy the current word under the cursor denoted by <cword>. So you can say /<C-R><C-W> and that will get converted to /static given that your cursor is on the word static.

What about simply hitting * with the cursor in static?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top