What does HackerNews think of undotree?

The undo history visualizer for VIM

Language: Vim Script

What's helped me much more lately is undotree for vim [1]. It basically logs every single time a file is saved. Its much more useful because commits have to be made by humans and they may not do it often (and usually there is an incentive for "clean or working commits"). There have been many times where I went back to copy something from the undotree.

[1]: https://github.com/mbbill/undotree

> I really hate autosave. I like using saving like a checkpoint where i have the ultimate undo button by ditching the unsaved changes.

Although I don't use autosave, I don't think it matters that much with vim because you can always use undotree[0]

0: https://github.com/mbbill/undotree

Vim has a plugins for that. ;)

I use https://github.com/mbbill/undotree but if that's not to your taste there are many others.

e.g. https://docs.stevelosh.com/gundo.vim/

Plug for the Vim undotree plugin, which exposes Vim’s undo tree in a navigable UI. It’s saved my butt in the rare occasion I need it. https://github.com/mbbill/undotree
Vim's non-linear undo[1] history is hard to beat. Set undofile [2] and you are done with local versioning. For visualisation of the undo tree, install undotree [3]

[1] https://vimhelp.org/undo.txt.html#undo

[2] https://vimhelp.org/options.txt.html#%27undofile%27

[3] https://github.com/mbbill/undotree

vim had an undo tree for 10 years (or longer?) [0] and there are plugins (eg [1]) that make it very easy to go back in history and also to explore different branches of your undo/edit history. Dura will not track changes that are not saved to disk IIUC

[0]: https://vimhelp.org/undo.txt.html#undo-tree [1]: https://github.com/mbbill/undotree

if you use vim, you can do things like ':earlier 5m' to see code from 5min ago. in fact, vim keeps a whole undo tree available, and some plugins will let you visualize it. https://github.com/mbbill/undotree
I've not seen it mentioned yet so I'd be remiss not to link to undo tree [1] for vim. I tend to put my list of plug-ins on a diet over time, but undotree is one I always kept! Having a visual of the history (like in the article) make it much easier to do a quick back and forth through time.

Also for fun, consider having your scroll wheel traverse time instead of space [2].

[1] https://github.com/mbbill/undotree [2] https://xkcd.com/1806/

> > (3) There is no visual indicator of where you are are in your undo/redo history.

> There might be plugins that somehow present this info in the interface.

The undotree vim plugin [1] does this, and gives both the file at the time as well as a diff of what changed.

[1]: https://github.com/mbbill/undotree

Pairing this with undotree[1] is really handy, as it allows you to see your full edit history, branches and all, and jump back and forth.

[1] https://github.com/mbbill/undotree

Yeah. I love vim's persistent undo. Combine that with the undotree[0] plugin and you never have to worry about losing changes.

It would be really hard for me to switch to an editor without persistent undo.

[0] https://github.com/mbbill/undotree

I have this in my .vimrc which serves a similar purpose:

    " persist undo history to file / across sessions
    set undofile
    set undodir=$HOME/.vimundo
    " max out history length
    set history=9999
    set undoleves=9999999999
    set undoreload=10000

(Don't forget to mkdir "$HOME/.vimundo".)

Combine that with https://github.com/mbbill/undotree and you can easily walk the entire history of every file you edit.