6

I want to keep in the undo history just one change for a long command such as: d0kJx. (I took the command from this answer.)

This command (d0kJx) does this (The ^ is the cursor position):

Before:

a bc def ghi
j k l mn o p q rs
      ^

After:

a bc def ghimn o p q rs
            ^

If this is possible, how can I do this? I think that maybe the answer is to extend the command in some way.

Thank you very much! :-)

  • 1
    For this specific command, it's worth noting that Karl's answer to your other question—hvk$d—is also undoable with a single u. – Wildcard Oct 29 '15 at 13:13
11

I think you are interested in :h undo-blocks.

To make the long command, e.g. d0kJx, undoable as a single change, you can run it from the command line through normal, e.g.:

:normal! d0kJx

Here the ! ensures that we do not use custom mappings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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