Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.configure should be .setup #112

Closed
Diablo-D3 opened this issue Aug 20, 2022 · 4 comments
Closed

.configure should be .setup #112

Diablo-D3 opened this issue Aug 20, 2022 · 4 comments

Comments

@Diablo-D3
Copy link

Most Neovim Lua plugins are choosing to name their init entry point as .setup, not .configure, especially in the nvim-lsp ecosystem.

@RRethy
Copy link
Owner

RRethy commented Aug 20, 2022

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.

@RRethy RRethy closed this as completed Aug 20, 2022
@Diablo-D3
Copy link
Author

Works for me. I do actually miss when merely installing a .vim script with aus in it was enough.

@RaafatTurki
Copy link

RaafatTurki commented Jan 25, 2023

@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.

@RRethy
Copy link
Owner

RRethy commented Jan 31, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants