News for hackers. Stuff that matters.
Re:Undo in Vi and Its Successors by Lio on Tuesday February 17, 2026 @09:10AM (#47047632)
It's not mentioned in the article but Vim (and NeoVim) keep undo/redo history in a tree rather than a simple linear timeline[1].

The practical usage is it's aways possible to get back to a previous state you were in, which is pretty neat.

e.g. You can undo 5 changes, try something else and decide that you prefered the text before you started undoing things. In most programs with a linear undo history you've wiped out your previous changes but not in Vim.

You can hop about the branches of the undo tree using the g+ and g- commands but it's much easier to add an undo tree visualiser plugin such as the venerable old Gundo[2].

1. https://neovim.io/doc/user/undo.html

2. https://docs.stevelosh.com/gundo.vim/

Re:Undo in Vi and Its Successors by bradrn on Tuesday February 17, 2026 @09:20AM (#47047758)
Emacs has this too, with ‘undo-tree-mode’.

(Incidentally, the documentation is wonderful: ‘The only downside to this more advanced yet simpler undo system is that it was inspired by Vim. But, after all, most successful religions steal the best ideas from their competitors!’)

Re:Undo in Vi and Its Successors by sepeth on Tuesday February 17, 2026 @10:38AM (#47048668)
I haven’t been using Emacs for a long time now, but isn’t the Emacs way better? With undo tree you don’t lose any history, but the same is true for what Emacs does by default and it is much easier to navigate the history, since every change is part of a linear history and undos and redos also get added to it.
Re:Undo in Vi and Its Successors by ghosty141 on Tuesday February 17, 2026 @09:55AM (#47048152)
I had occasional problems with undo-tree (the tree broke occasionally), I've been using vundo for a while now and I'm a lot more happy with that.
Re:Undo in Vi and Its Successors by nesarkvechnep on Tuesday February 17, 2026 @10:53AM (#47048858)
The mark and diff functionality is great too.
Re:Undo in Vi and Its Successors by scoops_ on Tuesday February 17, 2026 @12:32PM (#47050259)
Another day, another great Emacs package I’ve just learned about. This one’s going in the init.el for sure!
Re:Undo in Vi and Its Successors by gmmachine on Tuesday February 17, 2026 @10:44AM (#47048738)
Strange, I love GNU screen, and find the key combinations very easy and intuitive. However, I could never seem to master GNU's Emacs and what I find are very strange default key commands. I love vim for the reason of, what I personally find, very intuitive key combinations.

I just downloaded VSCode for the first time recently -- which I was delighted to find has a VIM mode. From what I read VSCode's VIM mode does not respect the undo tree of actual VIM.

Re:Undo in Vi and Its Successors by noelwelsh on Tuesday February 17, 2026 @11:46AM (#47049548)
A good number of Emacs users work with Vim key bindings. evil-mode is very good. I use Doom Emacs, which uses evil-mode by default.
Re:Undo in Vi and Its Successors by colpabar on Tuesday February 17, 2026 @11:50AM (#47049592)
fun fact: sublime text also has a vim mode (called "Vintage mode" which is just hilarious) that is built-in but disabled by default, rather than an extension like in vscode. vim keybinds are just the best.
Re:Undo in Vi and Its Successors by nothrabannosir on Tuesday February 17, 2026 @09:35AM (#47047927)
undo-tree-visualize is easily one of the biggest wow factors for unfamiliar users. Cannot unsee, cannot go back.
Re:Undo in Vi and Its Successors by behnamoh on Tuesday February 17, 2026 @11:10AM (#47049061)
I use undo-tree plugin to use this in a nicer way. It's such a gem!
Re:Undo in Vi and Its Successors by sodapopcan on Tuesday February 17, 2026 @09:21AM (#47047765)
I figured that this was what this article was going to be about.
Re:Undo in Vi and Its Successors by embedding-shape on Tuesday February 17, 2026 @10:44AM (#47048750)
I thought so too, it's a part I've always struggled with effectively using, cause I get lost so quickly so was happy for a moment. But then reading the comments first, I got disappointed before I even had a chance to open the article.
Re:Undo in Vi and Its Successors by sodapopcan on Tuesday February 17, 2026 @01:20PM (#47050950)
I find it impossible to use without a plugin. I use https://github.com/mbbill/undotree and map it to `U` since I realized I never use `U` and it's easy to remember. https://github.com/sjl/gundo.vim/ is also popular but I like that the former is in pure vimscript (and the interface is a lil' better IMO).
Re:Undo in Vi and Its Successors by boltzmann64 on Tuesday February 17, 2026 @09:21AM (#47047761)
If you are going to need this, then you should use git instead of relying on the editor's undo tree.
Re:Undo in Vi and Its Successors by Lio on Tuesday February 17, 2026 @09:31AM (#47047873)
You could if you remembered to make commits between every small, low value text edit. :P

Meanwhile the undo/redo tree is always there, ready to use and has no overhead. You can ignore it completely until you need it to save your arse.

Re:Undo in Vi and Its Successors by sodapopcan on Tuesday February 17, 2026 @09:24AM (#47047803)
They are both useful. I'm a frequent committer but find myself using this, I wanna say, 0 - 3 times per month. It's one of those things that when you want it, you're really glad it exists.
Re:Undo in Vi and Its Successors by munk-a on Tuesday February 17, 2026 @10:53AM (#47048859)
Undo is something that's extremely useful after the fact - commits can accomplish the same end if you're fastidious about continuously committing but fall short if you only realize your need after you've made the edit.
Re:Undo in Vi and Its Successors by Waterluvian on Tuesday February 17, 2026 @09:27AM (#47047842)
Consider this capability being used over the span of seconds as just another text editing tool. It would be like saying we don’t need undo/redo at all, just use git.