tags:

views:

1104

answers:

5

I want to know if there is any way by which I can paste yanked text to the command window. For eg. if I have yanked a word and I want to grep it in some location I cant simply paste the word using 'p'. However if I copy it to clipboard, Shift-Insert will paste the same thing.

Is there any tweak available which would allow me to paste yanked text to the vim command prompt? I am using gvim on Windows.

+11  A: 

try to use

<ctrl+r>"

where " stands for default register.

Mykola Golubyev
Note that this also work in normal insert mode, not only on the command line.
If you use `*` instead of `"`, you'll get the contents of the system clipboard instead (which might be handy).
dash-tom-bang
+5  A: 

<C-R>" Will paste default buffer. Alternately, you can use q: to open a buffer for the next command. try :help q:

soulmerge
+2  A: 

Press :, then ctrl-r and then ", all while in normal mode.

ldigas
Technically, once you press :, you're no longer in normal mode.
graywh
@graywh - good point !
ldigas
A: 

You can yank to the clipboard using the * named buffer. For instance, this will copy the current line to the clipboard:

"*yy

So you can copy a line using this, and then paste it with shift-insert in the commandline.

Similarly, you can paste from the clipboard like this:

"*p
Nathan Fellman