WIP: fix(session): clear buftype on VimLeavePre so mksession saves oil URLs #195

Closed
barrettruth wants to merge 1 commit from fix/session-restore into main
barrettruth commented 2026-03-19 16:35:00 +00:00

Problem

mksession treats buftype='acwrite' buffers as blank windows when blank is excluded from sessionoptions, silently omitting oil windows from saved sessions. Affects all session plugins that auto-save on exit (persistence.nvim, auto-session, etc.).

Solution

Register a VimLeavePre autocmd that clears buftype on all oil buffers before Neovim exits. The session writer then sees them as regular file buffers and saves their oil:// URLs. On restore, canola's BufReadCmd handler re-initializes them normally.

Mid-session :mksession calls are not yet covered — that requires a SessionWritePre event tracked at neovim/neovim#22814.

Closes #149

Consolidates

## Problem `mksession` treats `buftype='acwrite'` buffers as blank windows when `blank` is excluded from `sessionoptions`, silently omitting oil windows from saved sessions. Affects all session plugins that auto-save on exit (persistence.nvim, auto-session, etc.). ## Solution Register a `VimLeavePre` autocmd that clears `buftype` on all oil buffers before Neovim exits. The session writer then sees them as regular file buffers and saves their `oil://` URLs. On restore, canola's `BufReadCmd` handler re-initializes them normally. Mid-session `:mksession` calls are not yet covered — that requires a `SessionWritePre` event tracked at neovim/neovim#22814. Closes #149 ## Consolidates - stevearc/oil.nvim#232 - stevearc/oil.nvim#664 - stevearc/oil.nvim#678
barrettruth closed this pull request 2026-05-02 02:09:07 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.