Fandom

Vim Tips Wiki

Paste from the clipboard into a new vim

Redirected from VimTip771

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 771 Printable Monobook Previous Next

created August 17, 2004 · complexity basic · author Peter Wilson · version 5.7


Bind a keystroke to "xclip -o | gvim -" ( or "xcb -p 0 | gvim -" or "any command which prints the contents of the clipboard | gvim -")

Pressing that key now captures the contents of the clipboard in a new Vim window.

CommentsEdit

I don't have xclip. I just click middle mouse button to paste clipboard, also in Windows gvim.

For scripting you could also paste the clipboard register: "*p


You can also do

gvim.exe -c 'normal "*p'

or to a named file

gvim.exe -c 'normal ggdG"*p' file.txt

from VimTip305

Put the paste code into a windows batch or Unix Script.


This seems complicated. Simply use commands:

:new
"*p

Also on Fandom

Random Wiki