Hacker News new | past | comments | ask | show | jobs | submit login

>Modal editing isn't enough if you type whole sentences/paragraphs of text within a single insert session

Why not? Honest question.




Because 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


I 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.


While the inferiority of your workflow doesn't matter to you, it's still a point against undo being "solved" by vim


What problem does a magical "does what I mean" undo solve that pressing ^W or ^H doesn't? At a minimum, your "superior workflow" is "<Esc>ui" or "^Ou", both of which are more keystrokes and require your editor to read your mind.


Or my superior workflow is Alt-u or hold U, which is a single shortcut/keystroke, so you lose there as well

The other issue with your attempt at solving undo without undo is that the deletion doesn't become part of redo, also a single word with a typo could be in the middle of a paragraph where you navigated with a trackpad, while ^W would delete near the current cursor position

You don't need magic to fix the ubersimplicity of current defaults, just a bit of openness


^W is ctrl-W.


So what? How does it address the issue I've described?


It's the same number of keypresses as alt-U.


So now it's not "more keystrokes" as you originally claimed (and it's a higher number of keypressses vs holding U), and you still haven't addressed the issue with ^W I've described


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.


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?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: