casouri / vundo

Visualize the undo tree.
469 stars 23 forks source link

Remove all undo/redo history for current buffer? #108

Closed fapdash closed 5 months ago

fapdash commented 5 months ago

Is there a way to throw away all undo/redo history information for the current buffer?

I try to do this in the following scenarios:

  1. When I accidentally yanked / pasted in a secret that I don't want to accidentally show on undo.
  2. To keep my history clean once I'm certain that I don't need any earlier history for that particular file

Of course this would also help for https://github.com/casouri/vundo/issues/68.

jdtsmith commented 5 months ago

M-: (setq buffer-undo-list nil) is a heavy hammer that works. I sometimes reach for it when history is too deep. I do still wish for a command to specify a time frame (e.g. two weeks) and remove anything on the undo list "older" than that. That would only work for buffers which had been saved to file.

casouri commented 5 months ago

If you really need it, it shouldn't be hard to write a command that truncates the undo history by date.

jdtsmith commented 5 months ago

Shouldn't be just need to find a bit of time. A better fix is #106, then I wouldn't feel the need so often.

fapdash commented 5 months ago

@jdtsmith Thank you, M-: (setq buffer-undo-list nil) was exactly what I was looking for! :)

jdtsmith commented 5 months ago

OK it actually wasn't too hard; give #111 a try.