Neovim's Small Delete Register


The "small delete" register automatically stores content that is deleted, as long as it meets the following conditions:

  1. the length of the content must be less than one line, and

  2. the deleted text must not have been directed to one of the named registers or the black-hole register.

If these conditions are true, then you can access the most-recently deleted text using this register. Like the numbered registers, the conditional behavior of this register can make using it somewhat less reliable that it might otherwise be, but it can be a helpful tool in some cases.

Lets look at a simple example. Starting from the following buffer

Initial Conditions
Beautiful·is·better·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMALTop1:1
 

we first use v to enter visual mode, move the cursor forward by two words using 2w, then finally delete the selected text using d. That produces the following buffer content:

Select and Delete Textv2wd
etter·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMALTop1:1
 

If we check the register contents, we can see that the deleted text has been copied into the unnamed register and also into "-, which is the name used to access the content in the small-delete register.

Register Content
etter·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMALTop1:1
 
:regType Name Content  c  ""   Beautiful is b  c  "-   Beautiful is b

Finally, we can paste the content from the small-delete register back into the document using "-P

Paste From Register"-P
Beautiful·is·better·than·ugly.
Explicit·is·better·than·implicit.
Simple·is·better·than·complex.
Complex·is·better·than·complicated.
NORMALTop1:14
 

which returns the buffer to the original content.