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.

How can I disable persistence undo in Vim 7.3?

I found that sometime, after doing some code modification, I want to go back to the state that i just open that file. But if have such persistence undo option, when i pressing u , it will undo more than i want.

share|improve this question
    
Pressing U should step back through the edit tree. like ctrl and z in word. I'm not sure I understand, if you press U is it doing too much in which case are you sure you have the undo buffer active? –  David McGowan Sep 9 '12 at 13:17
    
the persistence undo will also save my edit history after i close the file. so when i reopen the file again, when i press U, it can undo my previous change I close the file. that is not i want :( –  Kit Ho Sep 9 '12 at 13:26

2 Answers 2

up vote 3 down vote accepted

Persistent undo is an opt-in feature. If you don't want it simply remove the related settings that you have put in your ~/.vimrc.

Removing set undofile and manually deleting the undo files should be enough.

See :help persistent-undo.

share|improve this answer
    
Note that the vimrc_example.vim includes set undofile by default now. So user who source vimrc_example.vim in their own .vimrc may be getting this option without intending to. –  Ben Apr 1 at 18:17

A solution without disabling persistent undo would be the :earlier 1f command. This rewinds the undo history to where it was the last time the file was saved. (You can keep executing it to go to each previous save spot, or supply a number other than 1 to skip several saves.)

share|improve this answer

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.