Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to not use vim's small delete register?

Tags:

vim

I'd like to have any deleted text always go into the numbered registers, but frequently I go to find something I deleted recently in the numbered registers and it's not there because it was less than one line.

Numbered register 1 contains the text deleted by the most recent delete or change command, unless the command specified another register or the text is less than one line (the small delete register is used then). With each successive deletion or change, Vim shifts the previous contents of register 1 into register 2, 2 into 3, and so forth, losing the previous contents of register 9.

It's a fairly rare thing, but when it happens, it's really annoying because I have to undo back to the point where I deleted the text, then either delete into a named register or immediately use the deleted text before it's out of register 0 because I delete something else (stray whitespace, bad comment, whatever) on my way to pasting the small text I just deleted.

I'd like the small delete condition not to matter for text entering the numbered registers 1-9. Anyone know of a way to achieve this?

like image 846
mmrobins Avatar asked Feb 20 '13 04:02

mmrobins


2 Answers

During another such feature request on Reddit, it was found out that there was a bug in Vim that did exactly that when

:set clipboard^=unnamed

That bug has been fixed in Vim 7.3.649. So, if you use an older version, you could still benefit from the bug :-)

If you really think this is useful behavior, you could raise this enhancement request on the vim_dev mailing list, though in general, additional options are frowned upon. Your chances are higher if you can make a compelling argument and also supply a complete patch with documentation and tests.

like image 159
Ingo Karkat Avatar answered Oct 06 '22 07:10

Ingo Karkat


Check out the Pull Request into the neovim editor:

[RFC] Add an option to use numbered registers for smaller deletions #8169

I've tried to add the smalldel option, which allows you to configure the minimum number of deleted characters to be pushed into the numbered registers "1.."9

The next neovim release after this PR is merged will contain this option.

like image 41
Himura Avatar answered Oct 06 '22 07:10

Himura