Neovim's Black Hole Register

Now that we have learned how to store text in a register and retrieve it, lets take a quick look at one of Vim's other registers - the black hole register.

The black-hole register is fairly simple, this register can be written to just like the named registers, but the value is not stored. As a result, when the black-hole register is read it returns nothing.

To see it in action, starting from the following buffer lets yank the first line into the black-hole register:

TBD
y"_y
Beautiful·is·better·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMAL
Top
1:1
 

Now, when we check the registers we can see that nothing has been stored:

TBD
Beautiful·is·better·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMAL
Top
1:1
 
:reg _
Type Name Content

You might be wondering how this might be useful. In some cases it can be convenient to execute a yank or delete without storing the content in a register, and the black-hole register provides a way to do so. We will see one example of this in the next section.