fix(view): suppress W10 warning when nvim is launched with -R

Problem: when Neovim is started with -R (read-only), all buffers get
readonly=true. Oil's render_buffer toggles modifiable to write directory
listings, which triggers "W10: Warning: Changing a readonly file" on
every directory navigation.

Solution: clear readonly on oil buffers during initialization. Oil
buffers are buftype=acwrite — readonly has no meaning for them since
writes go through BufWriteCmd, not the filesystem.

Resolves: stevearc/oil.nvim#642
This commit is contained in:
Barrett Ruth 2026-02-20 20:23:24 -05:00
parent c6b4a7a07b
commit ca834cf703
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -384,6 +384,7 @@ M.initialize = function(bufnr)
group = "Oil",
})
vim.bo[bufnr].buftype = "acwrite"
vim.bo[bufnr].readonly = false
vim.bo[bufnr].swapfile = false
vim.bo[bufnr].syntax = "oil"
vim.bo[bufnr].filetype = "oil"