Yet another way to paste is just to 'r'ead 'cat' output:
:r!cat
This will run cat in the foreground, so you can send to the terminal what you want to insert/have in your clipboard.After you are done, press Ctrl+D to end the stream.
The benefits is you do not need to mess with indentation. The text is inserted right as is.Note in cat's place, there could be any command, like fold (I used to use this until I discovered gq) or any other filtering utility.
Although the '+' register seems to be more vimic, it does not work on all platforms, while r!cat just works.
'w'rite can be used pipe selection/range to an external utility's standard input. An example for an X system to copy to the clipboard:
`<,`>:w !xsel -ib
(I.e., make a visual selection and type :w !xsel -ib
)
My bindings:
" Ctrl + K, Y while in visual modevnoremap <silent> <expr> <C-K>y ':w !xsel -ib<CR><CR>'" copy from yank register while in normal modennoremap <C-K>y :call system("xsel -ib", getreg("@0"))<CR>nnoremap <C-K>r :r!cat<CR><CR>