Reputation: 11585
How to copy the ex command to the clipboard or paste it to the buffer?
Using gvim on Windows.
Upvotes: 42
Views: 15340
Reputation: 1648
To copy the last executed command to your clipboard:
:let @+=@:
Essentially assign the command (:) register to the system clipboard (+) register.
Upvotes: 13
Reputation: 2688
not exactly an answer to the question, but on the same lines, the command ":p
will put/paste the last ex command into the file. it can then be yanked into the clipboard with the command V"+yy
neither of these will open another window.
they are also useful for when you come up with a really good really long command that you want to save.
Upvotes: 3
Reputation: 75704
The windows clipboard can be accessed through the buffer +
. So pasting your clipboard as an ex-command can be done with <C-R>+
. If you want to copy your ex-commands to the clipboard, you need to show the command history (q:
) and copy it into the clipboard buffer ("+yy
).
Upvotes: 46
Reputation: 6392
Enter command history with (from normal mode)
q:
Then select and copy(yank) commands you need with
"*y
Upvotes: 20
Reputation: 116401
If you source mswin.vim in your setup it will map the default Windows copy/paste keys to use the clipboard. If you want to do it yourself please see Soulmerge's answer.
Upvotes: 0