feat: automatic lazy loading + health check + support configuration with vim.g
#7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey 👋
Nice plugin!
I would love to use it, but the need to call a
setup
function to enable this plugin's functionality has some caveats:setup
function, even without using oil.nvim.This PR uses Neovim's built-in
ftplugin
feature (see:h runtimepath
) to make sure this plugin initialises itself lazily, when opening aoil
filetype.As a nice side-effect, this also means that users (or plugin managers) don't have to worry about the order in which oil.nvim and this plugin are configured (oil.nvim must be loaded in order for Neovim to know about the
oil
filetype).The
setup
function only sets the config, but doesn't load anything.I've also added a small health check.
And, since
setup
now only overrides the default configuration, I have added support for configuring this plugin with avim.g.oil_git_status
table.This has two benefits over a
setup
function:require
call (allowing users to disable the plugin without deleting the config).g:oil_git_status = { "show_ignored": 1 }