Hacker News new | ask | show | jobs
by linsomniac 921 days ago
There are alternatives to "undo", which are probably better suited to "undo last word" without making "what will undo undo" more mentally complicated. Having undo reverse the last edit, whether that's a word or a few words or adding an argument definition to a function, or adding an "if" block -- makes it very easy to keep in your head. "I want to undo that last thing I did".

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.
1 comments

understanding of what that "last thing I did" isn't session specific, like "adding an if block and a long comment describing what that block does" is semantically two last things I did, the fact that they're happening within a single insert session doesn't help. And I don't really need too keep it in my head, a solved undo would make it visually obvious to free my head

The alternatives you suggest are bad: 1. This is no undo, so then it's not part of redo

2. Why would I ever want 3 undo points if I indent my comment a bit by 3 spaces?