Closed Diablo-D3 closed 1 year ago
The history of why plugins use .setup
is because of this article by norcalli. After that was published a bunch of plugin developers starting following that until it just became a thing everyone did without thinking about it. It was a bad idea then and it's a bad idea now. Having to install a plugin and call require('plugin_name').setup({})
a bunch of times in your config is pointless. If we look at traditional Vim plugins (see every tpope plugin), installing them is sufficient to get them to work, no useless one-liner call to .setup
needed.
In terms of the name .configure
, it's to distinguish from the fact that it doesn't start anything, you can omit .configure
and the plugin will still start up. This is different to how .setup
is used in a lot of plugins which have it responsible for initializing the plugin as well as configuring it. Due to this semantic difference, I felt using .setup
was overloading the term.
Works for me. I do actually miss when merely installing a .vim script with au
s in it was enough.
@RRethy Historical baggage aside, a single entry point that kicks the plugin into action would give users better control over load order and lazy loading.
Having to install a plugin and call
require('plugin_name').setup({})
a bunch of times ...
Most plugins provide a plugin spec that does this part automatically like so:
{
'RRethy/vim-illuminate',
config = function()
require 'illuminate'.setup { ... }
end
},
It's worth noting that in order to disable setup-less plugins on some plugin managers uninstalling is the only option, in contrast with the above it's as easy as commenting setup()
.
It doesn't have to be named setup
ofc. this is obviously a breaking change, But I've seen other plugins go through this just fine.
Installing and starting a plugin should be 2 separate things, Kindly reconsider.
Most plugins provide a plugin spec that does this part automatically like so:
{ 'RRethy/vim-illuminate', config = function() require 'illuminate'.setup { ... } end },
Your description doesn't match the code sample, and even if it did, wouldn't that mean it's the same as not having the setup method in the first place just with extra steps?
It's worth noting that in order to disable setup-less plugins on some plugin managers uninstalling is the only option, in contrast with the above it's as easy as commenting setup().
That's a poorly written plugin manager or a misconfigured plugin manager. Neovim has the ability to do this builtin with opt/
plugins.
Installing and starting a plugin should be 2 separate things
It is. Installing vim-illuminate won't start the plugin. Loading the plugin will however start the plugin which conforms to the Neovim user manual.
Most Neovim Lua plugins are choosing to name their init entry point as
.setup
, not.configure
, especially in the nvim-lsp ecosystem.