AntonVanAssche / music-controls.nvim

Control you favorite music players with ease from within Neovim.
MIT License
2 stars 0 forks source link

Support lazy.nvim configuration #1

Open sjclayton opened 3 days ago

sjclayton commented 3 days ago

Describe the solution you'd like

It would be nice if there was native support for configuring this plugin using the default plugin spec of lazy.nvim as it is very popular and lots of people are using it.

It provides for passing options directly to a plugin, rather than polluting the _G.{variable} global namespace with extra variables.

Additional context

Examples

My current lazy config for this plugin

{
    'AntonVanAssche/music-controls.nvim',
    dependencies = { 'rcarriga/nvim-notify' },
    keys = {
      { '<localleader>j', '<CMD>MusicPlay<CR>', desc = 'Music - play/pause' },
      { '<localleader>k', '<CMD>MusicNext<CR>', desc = 'Music - next track' },
      { '<localleader>l', '<CMD>MusicPrev<CR>', desc = 'Music - prev track' },
      { '<localleader>;', '<CMD>MusicCurrent<CR>', desc = 'Music - current track' },
    },
    config = function()
      _G.music_controls_default_player = 'spotify'
    end,
}

What it would look like using lazy spec

{
    'AntonVanAssche/music-controls.nvim',
    dependencies = { 'rcarriga/nvim-notify' },
    keys = {
       -- user keymaps here
    },
    opts = {
       default_player = 'spotify'
    },
}

Thanks!!

AntonVanAssche commented 3 days ago

Hi @sjclayton,

I've added your feature request in the opts-setup branch (see commit: 457d91a). Feel free to test it before I merge it into the master branch.

The changes introduced in the above commit allow you to configure the plugin in the way you requested.

return {
  "AntonVanAssche/music-controls.nvim",
  branch = "opts-setup", -- (Temporary for testing)
  opts = {
    default_player = "spotify"
  }
}
AntonVanAssche commented 3 days ago

Changes related to documentation have also been added to the same commit.