Vim to reset to oldest change?

I am a Vim user, and sometimes I made several changes to the file, but then I want to go back to the beginning and have to type: ua many times, so I ask you if there is a shortcut to get to the "oldest change"?

Hooray!

Rodrigo Alves Vieira http://rodrigo3n.com | @ Rodrigo3n

+3
source share
5 answers

Cancel keystrokes only u; if you press : u, then there are too many keys (although this works, these are four keys instead of one). Usually I just hold on uand allow the auto-repeat trick (note what Ctrl+Ris the opposite uif you go too far).

You can reload the latest saved version to disk using :e!.

+10
source

Does " :e!" (then return) work? It returns to the state of the edited file when it was last saved, or when you started, if you havenโ€™t saved yet ...

+5
source

:earlier. :help :ea

+4

:e!, , . u :u, . :h undo-redo .

vim, undo_tags.

+2

You know that you can use the number of retries for almost any VIM command, right?

My favorite way:

10000u

ten thousand cancellations.

Replaces me back in time, usually to where I opened the file. I see how things should be.

then

10000 ^ R

then thousand redos

And I'm at the end again.

Welcome.

0
source

Source: https://habr.com/ru/post/1766828/


All Articles