5 ms·
I just skimmed it, but it looks like vim really has undo/redo "solved": - Modal editing makes for nice "undo" points, clarifying whether undo should undo "
by linsomniac 3y ago
I just skimmed it, but it looks like vim really has undo/redo "solved":
- Modal editing makes for nice "undo" points, clarifying whether undo should undo "World!" or "!".
- "g-" and "g+" eliminate the "orphaned redo". They walk the entire undo/redo tree rather than just the linear undo/redo.
- Time travel undo/redo is really handy when you want to go to where you were on the wall-clock. ":earlier 15 minutes" takes you to the code as it was 15 minutes ago.
- thomastjeffery 3y agoDon't forget about the Gundo plugin: it lets you navigate your tree of undo history.
- JetSetIlly 3y agoGundo is great. There is also mundo, which is a fork of gundo. And, undotree, which doesn't require python support.
- bee_rider 3y agoI love vim but I actually find undo/redo to be one of the few annoyances of the program, because of the whole linear undo/redo thing. So I guess I need to look into this g+ option…
- thomastjeffery 3y agoAs I mentioned elsewhere, gundo is really helpful for navigating the undo tree. My favorite thing about vim's flow is that it isn't just limited to undo/redo: you can re-perform your most recent action anywhere using the . key.
- 38529977thrw 3y ago> ":earlier 15 minutes" takes you to the code as it was 15 minutes ago. TIL. Very cool. tnx
- 3abiton 3y agoBeen using vim for few years, never hears of that feature. Still a student.
- g0xA52A2A 3y agoJust to emphasize part of your comment as I think a lot a people aren't fully aware - Vim has an undo tree https://vimhelp.org/usr_32.txt.html#usr_32.txt https://vimhelp.org/usr_32.txt.html#usr_32.txt
- eviks 3y agoFar from solved Modal editing isn't enough if you type whole sentences/paragraphs of text within a single insert session Also undo in selection is required to "solve" it, as well as semantic points besides "last 15 minutes" (like "last saved session" or "last time you quit the editor") Also UI with a diff is sometimes better than having to undo/redo to see changes
- linsomniac 3y ago>Modal editing isn't enough if you type whole sentences/paragraphs of text within a single insert session Why not? Honest question.
- eviks 3y agoBecause it's too coarse: undoing the whole paragraph instead of just the last word with a typo is too much, so you'd have to be always aware of this limitation and break flow to switch modes for no other reason than to insert "undo points", and these are unnecessary mental bookkeeping chores
- miniupuchaty 3y agoI don't have this problem in practise. It's not "break flow to switch modes" for me. I don't type this way. There's always as much movement as there's typing, especially while programming. Even when writing prose I exit the insert mode each time I think of what to write next making this always a good "undo point". If I make a typo while in the insert mode I just remove last character or last word. I guess you could argue that this is something that undo should also cover but I don't see much need for that. I'm not in the insert mode, exiting to normal mode for movement and undo. I'm in the normal mode entering insert mode to write.
- eviks 3y agoWhile the inferiority of your workflow doesn't matter to you, it's still a point against undo being "solved" by vim
- funcDropShadow 3y ago> but it looks like vim really has undo/redo "solved" Does it support restricting undo/redo to a selection? In Emacs you can select any region of text and just apply the undo history of the selection. That is extremely useful. Imagine working on to functions in the same file. You have are working on g() and realize you want to undo some change on f(), that you did before. Most editors don't support that. In Emacs you can just select the code of f() and press undo (C-_). Several popular undo extension libraries break this feature.