3 ms·
Ask HN: Why don't more programs have an undo tree?
Vim users take it for granted that if they undo a bunch of changes and then make a new change, they will just create a new branch in the undo history and the undone changes will be preserved. Emacs users frequently use the undo-tree package to get something similar. However, most text editors just drop the undone changes with no way to get them back, as do all the image editors I've used.
An undo tree seems like such an obvious improvement over a linear undo history that I'm wondering, why is this feature so uncommon? Is it much harder to implement than it looks?
- boxingdog 4y ago[dead]
- johncoltrane 4y agoOne simple reason would be that an undo tree is unusable without a way to visualize it, which is exactly what the various Vim and emacs plugins provide, and not that useful in practice anyway. So you have to consider the cost of developing the underlying mechanism _and_ the UI and the benefits of working on a niche feature.
- amadeuspagel 4y agoRelated question: Why are undo and version control separate features?
- n8henrie 4y agoRelated -- for the last decade or so (neo)vim has been my primary editor, I'm probably an intermediate level user. I have never really delved into the undo tree. I use `:earlier` and `:later` sometimes, but usually just a lot of undo / redo. Does anyone have a good intro article they would recommend on how to get started? Preferably plugin-free (often using vim on bare bones machines, pis, fresh machines with minimal / no config, etc.).
- pkkm 4y agoI think that the most comfortable way to use it is with an undo tree visualizer plugin. But if you want to only use the defaults, you have g- and g+ to traverse the undo history in chronological rather than logical order, :earlier and :later which do the same but take a time argument like 15m, and :undolist plus :undo n which take you to a specific node.
- zikohh 4y agoJetbrains have something that achieves the same as undo trees https://www.jetbrains.com/help/idea/local-history.html#restore-changes-from-local-history https://www.jetbrains.com/help/idea/local-history.html#resto... see the gif But yes I wish it was the norm in all text editors.
- tooltitude 4y agovscode recently introduced a similar feature. It stores a pretty large number of versions of every file without direct commit to SCM.
- lern_too_spel 4y agoI prefer Emacs's default undo behavior to an undo tree. https://news.ycombinator.com/item?id=33560275 https://news.ycombinator.com/item?id=33560275
- tooltitude 4y agoBecause it's too complicated for many users.