I am editing a *.tex file. I don't have persistent-undo set. However, I can normally undo beyond my last save so long as I don't exit the file. That's fine.

Sometimes, however, I am presented with the message "Already at oldest change". That's quite a downer. Why does this happen sometimes?

My Vim version is below. It includes persistent-undo, but it shouldn't matter in the context of this question.

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 12 2021 19:50:09)
Included patches: 1-3755
Modified by <cygwin@cygwin.com>
Compiled by <cygwin@cygwin.com>
Huge version with GTK3 GUI.  Features included (+) or not (-):
   <...snip...> +persistent_undo <...snip...>
  • The oldest change (without setting undofile) is going to be the state of the buffer at the time it was loaded. So if I do vim file, ochange<esc>:write<cr>, I can still u past that :write (most recent save). But if I understand your question, you say sometimes this doesn't work? Maybe check undolevels. Also :help :undolist and related commands/sections.
    – D. Ben Knoble
    Jun 30, 2022 at 18:44
  • Thanks, D. Ben Knoble. I don't think it's undolevels because it's only a few actions back in time. As for undolist, I will try that the next time I see the problem (which is not frequent). At this instant, I've made far too many changes to the *.tex file. Jun 30, 2022 at 19:07
  • Well, it happened again. The :undolist command didn't show much. Two unspecified changes a few minutes back. It doesn't matter whether I repeat Ctrl+R until I run out of redo's or repeat u until I run out of undo's. Nothing visibly changes in the file when I do either of those, and :undolist shows the same two changes in both cases. Jul 5, 2022 at 22:41
  • Huh. What is :verbose set undolevels? (before and after it happens)? Is autoread set?
    – D. Ben Knoble
    Jul 6, 2022 at 14:27
  • I'll look at those when I re-encounter the problem, then post back. Thanks. Jul 7, 2022 at 15:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.