I am using nvim-qt on Windows and I have set up the clipboard option:

set clipboard=unnamedplus

I found that text in Select mode will go to the +, * and " register after I start to type the replacement text. If I have copied something into the + and * register, it will get wiped out.

How to prevent this behavior? i.e., prevent text selected in Select mode from going into the + and * registers? I can't seem to find the documentation on this.

Edit: I ask this question because the link snippet in ultisnips will create a snippet template with Text in Select mode, as soon as you start typing something, Text disappears and is put into + and * register, which is really annoying.

  • 2
    You mentioned ultisnips select mode. Have you seen this commit? Text goes to the black hole register if you use <BS> or <Del>.
    – husB
    Dec 3, 2019 at 2:06
  • @husB I am not aware of that. Thanks for pointing out :)
    – jdhao
    Dec 3, 2019 at 2:17

2 Answers 2


Vim doesn't want you to lose the deleted text, so it stores the replaced selection in the default register; due to your 'clipboard' configuration, this includes the clipboard. The usual way to avoid that is through specifying the black hole register, but that's difficult in select mode. You can switch to visual mode (<C-G>) and then do the replacing via "_ (black hole) c (change selection): <C-G>"_c

Note: There are also the autoselect[plus] values of 'clipboard' and :help 'go-a' that already work when you just make a selection. Based on what you describe, this doesn't apply to you.


You did two Evils, and then the third Evil came and seized you. So what is an advice you seek for? "Select mode" and "Clipboard" are pure evil. Remove them from your vimrc and forget for good. Always make it Vim-way, or switch to the Notepad for eternity.

Now, seriously

I can't seem to find the documentation on this.

From :h select-mode: "Printable characters, NL and CR cause the selection to be deleted". In Vim "deleted" is the same as "cut" in other editors. Now, you've crippled your Vim to use a single plus-register for nearly everything, and then - surprise! - it gets overwritten. You really can't do anything about it.

  • I use set clipboard=unnamedplus because I want to copy text from other applications and paste it inside Vim with p. Is there a better way for this?
    – jdhao
    Dec 2, 2019 at 15:31
  • 3
    @jdhao p and y use unnamed / digit registers by default, but you can overwrite it manually as needed with "+p, "+yy etc. If that seems too long you can also setup some mappings.
    – Matt
    Dec 2, 2019 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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