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
up vote 0 down vote accepted

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

Or you could always just :h 'clipboard'

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)

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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