Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.