refactor: migrate from setup() to vim.g.oil configuration #1
Labels
No labels
autorelease: pending
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream/digest
upstream/pr
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
barrettruth/canola.nvim#1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
oil.nvim currently uses the
require("oil").setup(opts)pattern for configuration. This requires an explicit function call at startup and prevents lazy.nvim'soptstable from being merged declaratively before the plugin loads. It also means config is not accessible untilsetup()has run, and the setup function itself has accumulated backwards-compatibility shims that make it harder to maintain.The Neovim ecosystem is trending toward
vim.g.<plugin>for static configuration (e.g.,vim.g.loaded_netrw). Plugins like snacks.nvim, lazy.nvim itself, and others have adopted this pattern.Solution
Migrate configuration to
vim.g.oil:This would:
optson the plugin spec and have it automatically assigned tovim.g.oilwithout needing aconfigfunctionconfig.luareads fromvim.g.oiland merges with defaults, no explicitsetup()call neededrequire("oil").setup(opts)working as a compatibility shim that writes tovim.g.oiland triggers initializationMigration path
vim.g.oilsupport alongsidesetup(). If both are provided,setup()wins.setup()with a warning.setup()in a future major version.Considerations
vim.g.oilis a plain table — no metatables, no functions. Callbacks likeis_hidden_file,highlight_filename, andview_options.sortare functions in the current config. These would need to remain insetup()or use a separaterequire("oil").configure()for the function-valued options.require("oil").on.hidden_file = function(...) endor similar.vim.g.This is a non-trivial refactor that touches config.lua, init.lua, and all documentation. It should be planned carefully to avoid breaking existing configs.
setup()entirely #39