I use Vim from the CLI and use tabs rather than buffers (as I understand the terminology). I may or may not open multiple files using the
-p option, but end up with a few tabs open at once. If I remember to do so, I'll run
:mkview on a tab when I've made changes that matter (usually folding). When I open a file I do
:loadview to get back to what I had. The
au BufWinEnter ?* silent loadview command, if understood, will load the view whenever I open the file, saving my keystrokes. Similarly
au BufWinLeave ?* mkview should save the status when I close the file. However, if I have not manually done
:mkview on a tab with folding changes and exit with
:qa only the folding for the current tab is saved, all others remain the way they were at the last manual
The only clue to the issue, and not a solution, is in the docs on
h: BufWinLeave which has:
When exiting and v:dying is 2 or more this event is not triggered.
It is possible that using sessions might help, except that I seldom have the same set of files open that I will want to open the next time.
So, how can I get all open tabs to save their state when I do a full exit?
:h v:dying. That's not going to be the problem under any normal circumstances. Personally I'd try various other "Leave" and "Unload" events for buffers and tabs (after reading the docs for each to make sure there are no reasons to disqualify it)...see if I had any better luck with those.
v:dyingisn't the source of the problem. I'm new enough to power-using Vim that the solution escapes me. The help for
:tabnewshows the sequence of triggered events when called. Is there a similar sequence somewhere for the events triggered for
vimcan have tab-pages, which can have windows, which can display a buffer. Correct?
:tabdo windo mkviewor similar would work? I think I’ve seen people manage a view for each window or buffer with two short autocommands, but idk how it interacts with tabs? If you want to try sessions, which I think are superior, you’ll probably like tpope/obsession.