molten-nvim icon indicating copy to clipboard operation
molten-nvim copied to clipboard

[Feature Request] Move options to `opts` argument in `setup()`

Open sghng opened this issue 5 months ago • 2 comments

Consider migrating options to the opts arg in setup(), which is a convention in many Lua based plugins for Neovim now.

For example, instead of:

vim.g.molten_image_provider = "image.nvim"
vim.g.molten_virt_text_output = true

We have

{
    "benlubas/molten-nvim",
    opts = {
        image_provider = "image.nvim",
        virt_text_output = true
    } -- implicitly calling `require"molten".setup(opts)` by Lazy.nvim
}

Related to #330

sghng avatar Sep 06 '25 23:09 sghng

A note for future implementation: the problem in #330 may need to be addressed first, since user may want to define key in LazySpec, which will cause the setup(opts) be called only when the corresponding key mapping is used. Thus leaving a corner case where commands are called without opts set.

sghng avatar Sep 20 '25 23:09 sghng

This needs a structure change but it won't be a drastic one.

  • [ ] Define a single Molten command in Lua
  • [ ] Change the commands defined in Python to functions instead (via @pynvim.function decorator, this would be a simple search and replace)
  • [ ] In Lua, properly routes different subcommand to their corresponding function in Python.

This seems to be a tangible roadmap without significant changes. It would also be a good time to migrate to a modern Command subcommand API.

sghng avatar Sep 20 '25 23:09 sghng