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.

I'm a pro user of vim, however, somehow I don't seem to have definitively figured out the use of time based undo, or maybe I don't really like it. Is there a way I can undo a deletion caused by Ctrl-w W3I will be really grateful for the help.

Thanks.

share|improve this question
    
If you're referring to undoing ^W deletes made as part of an insert operation, I'm with you in wanting to know. I guess you could remap it to something that saves the value in a script- or buffer-local variable, but I don't think there's a way to do this built into vim. But I'm confused by your mention of time-based undo, ie g- and g+, which AFAIK is not related to the use of i_^W. –  intuited May 29 '10 at 22:56
add comment

2 Answers

The tip title refers to Ctrl+U which is similar but not quite the same as Ctrl+W. However the same method can be used for both.

Recover from accidental Ctrl+U.

share|improve this answer
add comment
up vote 2 down vote accepted
:inoremap <C-w> <C-g>u<C-w>

u sets undo point to the current point. And then C-w does the deletion work.

share|improve this answer
add comment

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.