Today I was trying to copy and paste multiple lines in visual block mode and found this excellent answer on StackOverflow showing how to do it.

Below is a gif of what I was trying to accomplish:

enter image description here

When I tried this in my vim, it didn't work. But after I remove the set clipboard=unnamed from my vimrc, pasting a block worked flawlessly.

So, what the command set clipboard=unnamed does?

  • 1
    it's explained in :help 'clipboard-unnamed – Naumann Dec 10 '17 at 17:50

This question is answered at stackoverflow. It controls, how the clipboard register of vim is used.

Or you could always just :h 'clipboard'

| improve this answer | |

Visual-blocking pasting with set clipboard=unnamed works for me in Vim 8 but not in Neovim. I'm pretty sure the issue you're describing related to this longstanding bug in Neovim.

Workaround from the thread that worked for me (Neovim 0.3.1):

Install nvim-miniyank and add this to your config.

map p <Plug>(miniyank-autoput)
map P <Plug>(miniyank-autoPut)
| improve this answer | |
  • To add to jasonszhao's answer, if you are like me and dont wish to install a plug in just to fix this little issue, just specify a register when you copy and paste and it will work. e.g. "ay Maybe in 2030 it will be fixed. – run_the_race Feb 24 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.