Live data from Hacker News

Pasting in command line Vim doesn't have to suck

userobsessed.net

21–30 of 34 posts

Re: Pasting in command line Vim doesn't have to suck

#21

Earlier quoted context omitted.

:set pastetoggle= Wack F5, middle-click paste away.

Sure, that works great if you want to reach for the mouse.

As mentioned elsewhere, if your vim is compiled with clipboard support(:version and look for +clipboard), you can copy/paste from the clipboard.

* is the Linux selection register.

+ is your clipboard.

So yanking is just set paste, "+y or " * y, set nopaste. Similarly you can do a "+d in vim and ctrl-v it in your browser or anywhere you can access the clipboard. You can " * d/" * y and paste it with your middle mouse button.

Re: Pasting in command line Vim doesn't have to suck

#22

Vim can actually access the system clipboard (and, on Linux, the X clipboard). It's accessed as the * register (or + for the X clipboard). So, for instance: "*dd "*p or "+yy "+P And so on. Very convenient (and also much faster than Ctrl+V). On Ubuntu, this is only available in the Vim provided by vim-gnome or vim-gtk (even when running in a terminal).

Honest question: how is that faster than Ctrl+V? Is it because you don't need the mouse?

Re: Pasting in command line Vim doesn't have to suck

#23

Earlier quoted context omitted.

:set pastetoggle= Wack F5, middle-click paste away.

Sure, that works great if you want to reach for the mouse.

The mouse has nothing to do with it...

If you paste method doesn't let vim know what's going on, use pastetoggle, otherwise don't.

Re: Pasting in command line Vim doesn't have to suck

#24
post #22

Vim can actually access the system clipboard (and, on Linux, the X clipboard). It's accessed as the * register (or + for the X clipboard). So, for instance: "*dd "*p or "+yy "+P And so on. Very convenient (and also much faster than Ctrl+V). On Ubuntu, this is only available in the Vim provided by vim-gnome or vim-gtk (even when running in a terminal).

Honest question: how is that faster than Ctrl+V? Is it because you don't need the mouse?

Its not. You usually do most of your copying and pasting within vim so you can just use the normal past command, but it is annoying when you want to do something with the system clipboard.

Re: Pasting in command line Vim doesn't have to suck

#26
post #22

Vim can actually access the system clipboard (and, on Linux, the X clipboard). It's accessed as the * register (or + for the X clipboard). So, for instance: "*dd "*p or "+yy "+P And so on. Very convenient (and also much faster than Ctrl+V). On Ubuntu, this is only available in the Vim provided by vim-gnome or vim-gtk (even when running in a terminal).

Honest question: how is that faster than Ctrl+V? Is it because you don't need the mouse?

I'm sorry for the confusion. There are two ways it can be faster. The way you understood it, I guess, is in typing. The difference here is:

  i Ctrl v Esc
vs

  (Shift) " * p
Where, on my keyboard, both " and * requires the shift key, but YMMV.

What I meant, though, is the actual input of text. When pasting with Ctrl+V, that's like one character at a time for Vim, and that's visible, so if you paste a large body of text you can actually see it scrolling past. When working with buffer commands, it works just any other internal Vim buffer operation, which is instantaneous.

Post reply on HN