Hacker News new | ask | show | jobs
by jolmg 3 hours ago
> I don't know anything so compelling about it

For me, it'd be primarily having more than one undo. Not being able to undo the second-to-last change is pretty bad. In fact, vim's undo being set up as a tree that can be walked with g- and g+ is excellent. It's impossible to lose a state of the buffer, even if you undo and make changes. It's a lot more practical to navigate than Emacs' undo, too.

EDIT: I just realized that nvi can undo more than one change by having u toggle the direction and . continue in that direction. I don't think ex-vi could. busybox vi seems like it can undo multiple with u but it seems to have no redo.

1 comments

> For me, it'd be primarily having more than one undo

Do you mean infinite undo? nvi has that. I'm not sure what you mean "set up as a tree" wrt undo, but i'll look into it. I think of nvi's undo as linear - I can 'u' to "undo" and implicitly set my "undo direction" "backward in time" (as one would expect). If I want to "undo, even more", '.' (dot, period) to "do that last command again" is what I'll do. If I want to "undo an undo", 'u'. That has the effect of moving the "undo direction" back towards the state of the buffer we had at the beginning of our discussion here.

...and, now I see your edit ;)

^[u..........:wq

> I'm not sure what you mean "set up as a tree" wrt undo

:h undo-branches

There's also a plugin to show a visualization of the tree, but the tree is implemented within vim.

https://github.com/mbbill/undotree

Nice. I like it. Advanced history mgmt in between commits is compelling.