refactor: remove vim.g.oil declarative config

Problem: the `vim.g.oil` configuration path was added prematurely.
It adds a second config entrypoint before the plugin has stabilized
enough to justify it.

Solution: remove `vim.g.oil` support from `plugin/oil.lua`,
`config.setup()`, docs, and tests. Users configure via
`require("oil").setup({})`.
This commit is contained in:
Barrett Ruth 2026-03-10 22:43:02 -04:00
parent 8dd67f91e8
commit 14bb77d842
6 changed files with 119 additions and 146 deletions

View file

@ -1,27 +1,15 @@
local config = require('oil.config')
describe('config', function()
after_each(function()
vim.g.oil = nil
end)
it('falls back to vim.g.oil when setup() is called with no args', function()
vim.g.oil = { delete_to_trash = true, cleanup_delay_ms = 5000 }
config.setup()
assert.is_true(config.delete_to_trash)
assert.equals(5000, config.cleanup_delay_ms)
end)
it('uses defaults when neither opts nor vim.g.oil is set', function()
vim.g.oil = nil
it('uses defaults when setup() is called with no args', function()
config.setup()
assert.is_false(config.delete_to_trash)
assert.equals(2000, config.cleanup_delay_ms)
end)
it('prefers explicit opts over vim.g.oil', function()
vim.g.oil = { delete_to_trash = true }
config.setup({ delete_to_trash = false })
assert.is_false(config.delete_to_trash)
it('applies explicit opts', function()
config.setup({ delete_to_trash = true, cleanup_delay_ms = 5000 })
assert.is_true(config.delete_to_trash)
assert.equals(5000, config.cleanup_delay_ms)
end)
end)