And pasting to terminal Vim doesn't suck if your Vim is configured to detect mouse clicks or interface with the system clipboard. Using the system paste shortcut (command- or ctrl-V) in insert mode is not the way to do it.
:set pastetoggle=<F5>
Wack F5, middle-click paste away. "*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). 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.
<ESC>
(normal mode)
q:
(fully vim editable window of :command line history)
(edit one of the command lines, yank and put all you like)
(or edit the new blank command line at the bottom)
<ESC><ENTER>
(to execute the current line, or)
:q
(to quit without executing)
(normal mode)
Notice the symmetry of q: to get in, and :q to get out (if you don't execute).q/ and q? to edit and execute search history.
[edit formatting]
So I often need to find "where is this method defined" across a large project.
yw (yank word to get method into the " register)
:Ack <ctrl-r>" (ack plugin, paste that default " register)
<enter> yay! I found it.
Alternately: /foo (attempt to find foo in this file. Whoops, not there, where is it!).
:Ack <ctrl-r>/ (last search is in the / register).
There it is! :r !cat
(paste your stuff)
ctrl - D
Doesn't require any switching between paste modes.If you're ssh'd somewhere it's a different story. I've seen some things about sharing clipboards across shells, but I've never bothered to set it up.
Also, copy-pasta makes for bad code.
:a! <paste like normal> <C-c>
and that will paste with properly formatted text.
set pastetoggle=<F3>
http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_pas...
I just have this in my .vimrc, and pasting (with formatting), is as simple as copying text, going to vim and hitting 'p' in command mode.
for middle-click (system) clipboard:
:set clipboard=unnamed
for ctrl-c (X11) clipboard:
:set clipboard=unnamedplus
couple caveats:
* +xterm_clipboard
* 'unnamedplus' is only for >= 7.3.74
see here for more info http://vim.wikia.com/wiki/Accessing_the_system_clipboardnote: I used unnamedplus for a bit, but found it to be much less desirable than using the unnamed middle-click buffer...YMMV
ESC
Q --> to go to "ex" mode
i --> to start inserting
paste text here
. --> line containing a single period to exit "ex" insert mode
:vi --> to return to "vi" mode
...golfer, moi?
:h paste