3

This is related to this previous question: Numbered register doesn't record most deleted text within a line?

I want to know the rationale for this. I was writing an email and deleted a note in parenthesis (da(), then deleted the extraneous whitespace character with x. When I looked at my registers with reg, the text in parenthesis was not there.

3
  • You might be interested in this question, asking if it's possible to work around this behaviour.
    – Rich
    Commented Mar 30, 2017 at 8:37
  • 2
    Check out the black hole register. My current vim setup has: noremap x "_x With this I can delete a line/selection/whatever then clean up with x using visual select. Then paste the original deletion. This provides an excellent place to trash unneeded code and will keep from filling the numbered registers up.
    – Shadoath
    Commented Mar 30, 2017 at 22:49
  • makes the feature pretty useless IMO which is annoying when 'delete' also means 'cut'
    – JonnyRaa
    Commented Oct 20, 2017 at 14:45

1 Answer 1

3

The rational is to avoid the deletes to be shifted out of the numbered registers too soon. Typically, if you intent to re-insert deleted text after a while, you put it into a named register you can remember. If you believe you will not need this piece of text anymore, you don't specify a register.

But if you are like me, every once in a while you will regret having deleted some text. If it has been just a few words, the fastest solution is to re-type it. But if it has been a whole paragraph or a code block, I'm happy to find it in "1 to "9 somewhere. And I wouldn't want it to be kicked out of "9 meanwhile by a couple of deleted single-words.

And why one line, not something like "40 characters" which may be a border when it starts to hurt to lose text? Because you don't count characters. If you are doing deletions inside a line, you are aware: This will soon be gone forever.

In your case you may still undo all changes until your delete, yank it and redo everything. There you have your deletion back.

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.