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

Looks like my vim undofiles only track the last 500KB or so of changes. At the bottom of my gundo panel it goes from edit revision 1774 to 0 (the total number of revisions to the file is 2776). While this indicates the entire history may exceed 1MB, that is very acceptable since this is several days' worth of work (which, still not being complete, couldn't be inserted into the revision control system per my company's code check-in policies).

Is there a way to make it keep more history in vim's undotree? Not that it'll be particularly easy or fun to wade through it all, but not having it throw it away would be nice.

share|improve this question
Using version control is the obvious solution, unless you want to keep track of all your typos. – romainl Aug 29 '13 at 19:07
Yes. I have been retroactively loading up the vim revisions and inserting them into a git repo. We use p4 because the codebase is too big and interconnected for git to deal with it effectively, but tracking individual files manually using git works very well – Steven Lu Aug 29 '13 at 19:11
Take a look at :h undolevels – FDinoff Aug 30 '13 at 0:42
yep that's gotta be it, on account of 2776 and 1774 (i must have made 2 phantom edits). Thanks for the tip! comments need a "make this an answer" button. – Steven Lu Aug 30 '13 at 1:20
"this is several days' worth of work (which, still not being complete, couldn't be inserted into the revision control system)." Isn't that what branching is for? – Kyle Strand Jan 20 '14 at 21:18
up vote 1 down vote accepted

Take a look at :h undolevels. Set it to a really large number.

Copied below for convenience.

                                                'undolevels' 'ul'
'undolevels' 'ul'       number  (default 100, 1000 for Unix, VMS,
                                                Win32 and OS/2)
                        {not in Vi}
        Maximum number of changes that can be undone.  Since undo information
        is kept in memory, higher numbers will cause more memory to be used
        (nevertheless, a single change can use an unlimited amount of memory).
        Set to 0 for Vi compatibility: One level of undo and "u" undoes
                set ul=0
        But you can also get Vi compatibility by including the 'u' flag in
        'cpoptions', and still be able to use CTRL-R to repeat undo.
        Also see undo-two-ways.
        Set to a negative number for no undo at all: 
                set ul=-1
        This helps when you run out of memory for a single change.
        Also see clear-undo.    
share|improve this answer

You must log in to answer this question.

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