Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does vim always say 'Already at oldest change' when I try to undo?

Tags:

undo

vim

I couldn't find this problem asked about anywhere, so here it is for the next guy.

Somehow my vim, which is highly customized with tons of plugins far more complex than I care to debug, gets intermittently wedged in a state where if I hit 'u', it said 'Already at oldest change'. When I hit CTRL-R, it said 'Already at newest change'. But it wouldn't undo or redo anything.

Very frustrating.

like image 521
Skylos Avatar asked Sep 28 '22 08:09

Skylos


1 Answers

This happens when undolevels is negative which is apparently used to keep vim undo from using up memory. For some reason my undolevels was set to -123456.

Set your undolevels to a big positive number like 999999 and everything will return to normal.

You may also want to check your .vim file trees and such, if you're using plugins and states that do this, to persist settings on a per file basis, that they don't have 'setlocal' undolevel settings inside them. I had to clear out several dozen such nefarious configurations.

like image 159
Skylos Avatar answered Oct 05 '22 06:10

Skylos