Re: Revert all undos

Tim Chase <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
On 2024-10-23 15:53, BPJ wrote:
> Is there a single mapping or command for reverting/redoing all undos, or
> alternatively how could one be created, e.g. is there a way to get the
> number of extant undos?[1]
[snip]
> [1]: Obviously I can do `:w` before the undos and then `:e` but I keep
> forgetting the `:w`! :-)

While this works, note that it also loses those undo points and any
jumps (`:help jumplist`) or marks you've set in the file.

Often, if you're bulk-undoing, that's fine.  But it's worth being aware
that :e overwrites some state you might care about.


Other possibilities:

- you should be able to use a count with undo like

  15u

  and it doesn't complain about you requesting more undo than exists, so
  you can do ridiculous counts like

  99999u

  to undo lots of changes

- you can use :earlier and :later to navigate based the undo tree based
  on time rather than undo counts, so you can do things like

  :earlier 15m
  :earlier 2h
  :earlier 1f

(and in typing that up, I learned about the "f" suffix for
file-write-counts...nice!)

-tim





-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ZxkKOeXEQGcax4uB%40thechases.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.