by linsomniac · 2y ago · 0 comments
- 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.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.
TIL. Very cool. tnx
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
Why not? Honest question.
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.
The alternatives are:
- Control-W (delete the last word, stay in insert mode)
- "W" to move back a word (or "B" to move back a big word). So: <Esc>BC
There's apparently also a recipe for setting up vim to insert undo points whenever you hit space, so you could also enable that for the files you want to do that on.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.