Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Because I'm still learning vim, I quite often find myself mistakenly entering the wrong command (for example, let's say I entered ci{, when I meant ca{). When I do this, vi enters insert mode and (in this case) deletes some text, ready for me to enter a replacement. If I hit Esc at this point, I go back to normal mode, but the text that the c command deleted remains deleted. Is there a way for me to go back to normal mode whilst undoing the full effects of that command? (I'm aware I can hit u after Esc, but I'm looking for one key/accelerated key).

share|improve this question

create the binding yourself.

imap <C-u> <esc>u

This would make the key press of control-u go back to regular mode and issue the undo command.

share|improve this answer
    
Thanks for the tip. I was hoping for a built-in command, but maybe this is what I'll have to do. – Andrew Ferrier Sep 14 '12 at 17:22
    
The ability to define your own mappings is the strength. Trying to build in every user's desires would never work. So vim let's you put in whatever desires you want. – EBGreen Sep 14 '12 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .