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

feat: add more plugin spec fields #13

Merged

Conversation

nekowinston
Copy link
Contributor

Hi again 👋
Sorry about never finishing #3, I didn't have a reason to use any extra Python deps myself since drafting that PR.

This PR adds enabled, dev, cmd, main to the plugin spec,
and changes how keys are handled, using mkLuaInline:
2024-09-01🥺16 50 23@2x

Also implements dev by prepending dir with cfg.settings.dev.path. I ended up using this on my fork of neovim.nix, because Lazy apparently prefers the manually set dir over dev, at least for me.

I've also been trying to implement #6, I'll comment on that issue to clarify a few things.

Adds `enabled`, `dev`, `cmd`, `main`.
Implements `dev` by setting the prepending `dir` with `cfg.settings.dev.path`.
@willruggiano
Copy link
Owner

willruggiano commented Sep 2, 2024

This looks great. I'll take a closer look this week hopefully. One comment from my brief first pass is that you shouldn't have to change anything related to keys. Since we're just inheriting it as is and subsequently passing that to the Lua generator, you should be able to call mkLuaInline from your side. There may be something I'm missing though... again first pass was brief :)

This goes for anything that neovim.nix calls mkLuaInline on. IMO we shouldn't do that. Let the user do that if they wish.

@nekowinston
Copy link
Contributor Author

nekowinston commented Sep 2, 2024

the reason for opting for a mkLuaLine string in keys, is I'm not sure if there are ways to express

{ "key", "<Cmd>Command<CR>", desc = "foo" }

or

{
  "key",
  function()
    require("foo").bar()
  end, 
  mode = {"n", "v"},
  desc = "foo"
}

in Nix, since that would require lambdas (generators.toLua: type lambda is unsupported), or unnamed attrs for lhs/rhs of LazyKeySpec.

We could of course support Nix -> Lua for just {lhs, rhs} mappings, so maybe allowing str and a simple list of str?

@willruggiano willruggiano merged commit 867d08b into willruggiano:main Sep 12, 2024
1 check passed
@nekowinston nekowinston deleted the feat/more-plugin-spec-fields branch October 7, 2024 22:37
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

Successfully merging this pull request may close these issues.

2 participants