How can I undo all changes since opening a buffer? I imagine there may be some form of :earlier
that does this.
Update: Many are suggesting
From the documentation
:u[ndo] {N} Jump to after change number {N}. See |undo-branches| for the meaning of {N}. {not in Vi}
If you type
:u 1
it appears to go to after the first change; pressing u
or typing :u
will then go back to the change.
Otherwise, you can use a very large count to :earlier
or g-
e.g.
:earlier 100000000
or 100000000g-
If you put this into a mapping/command, it could do any of these without too much trouble. e.g.
:nnoremap