History
Article Edit this page Discussion

Paste from the clipboard into a new vim

From Vim Tips Wiki

(Redirected from VimTip771)
Jump to: navigation, search

Tip 771 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.

[edit] Comments

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

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto Wiki
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Paste from the clipboard into a new vim"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation