Den ons 23 okt. 2024 16:38Tim Chase <[email protected]> skrev: > 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. >
Oh, good to learn that. I think I have noticed marks disappearing, definitely undos. Sometimes when writing part of a file to a file with another format/extension — typically in order to quote some code snippet in a Markdown file — I'll get the original file set to the wrong syntax/format — probably because my syntax/format hacks in `~/.vim/after/` are shitty but anyway! — and `:e` is then the easiest way to restore things. > > 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 > Very good to know as I have been worrying about not knowing how many changes I need to undo. > - 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 > Didn't know about these! > (and in typing that up, I learned about the "f" suffix for > file-write-counts...nice!) > Very nice and very useful, especially if `:w` doesn't have the same side effects as :e mentioned above! Thanks a lot! /bpj -- -- 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 visit https://groups.google.com/d/msgid/vim_use/CADAJKhAXnFpvE7GCxBdGM5yPAmO_juSsX4evOTc%3D3ZzbMffk6g%40mail.gmail.com.
