Today I learned how to paste into Vim in insert mode (and normal mode).
When I write my blog posts, I often have to refer to material from the internet: other articles, blog posts, or books.
That means that I will have to copy the title and URL from the web and paste it into my Vim editor.
First of all, the
"+ [registers][vimregisters] are for the system clipboard.
If you are in normal mode, you can paste with
You can add some clever settings to your
nnoremap <leader>rr "+diwP"
That key-binding will replace the word under the cursor with the system clipboard. It will first delete the current word (
iw) and then
put (paste) the stuff inside the clipboard before the current cursor (
Now, how can you paste code from the clipboard without leaving insert mode?
<CTRL+R> (or in Vim-speak:
<C-R>) comes into place. Use
<C-R>+ to paste from the