From c932ca131368ec6217a8b5ce57a6aaf1788f93b3 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 21 Feb 2026 02:17:34 -0500 Subject: [PATCH] fix: set buftype before BufEnter fires on oil buffers Problem: oil sets buftype='acwrite' inside view.initialize(), which runs in an async finish() callback after adapter.normalize_url(). BufEnter fires before finish() completes, so user autocmds that check buftype on oil buffers see an empty string instead of 'acwrite'. Solution: set buftype='acwrite' early in load_oil_buffer() alongside the existing early filetype='oil' assignment, before the async gap. The redundant set in view.initialize() is harmless (idempotent). Closes: stevearc/oil.nvim#710 --- lua/oil/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/oil/init.lua b/lua/oil/init.lua index db454d8..00e6b14 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -1082,6 +1082,7 @@ M.load_oil_buffer = function(bufnr) -- (e.g. ssh) because it will set up the filetype keybinds at the *beginning* of the loading -- process. vim.bo[bufnr].filetype = "oil" + vim.bo[bufnr].buftype = "acwrite" keymap_util.set_keymaps(config.keymaps, bufnr) end loading.set_loading(bufnr, true)