NotAShelf / nvf

A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
https://notashelf.github.io/nvf/
MIT License
158 stars 26 forks source link

which-key: allow null in registers #303

Closed diniamo closed 3 months ago

diniamo commented 3 months ago

Useful for disabling registers defined by nvf. Although that shouldn't be needed in the first place, since defining static registers doesn't account for the user changing the keymaps. For example, if I change all my telescope binds to start with <leader>s instead of <leader>f, then I'll have both prefixes appear in which-key.

See https://github.com/diniamo/niqs/blob/72039800e859e4f790c3a0d8a7759c06d9c222b9/home/nvf/plugins/telescope.nix

FrothyMarrow commented 3 months ago

There isn't a seamless way to integrate whick-key and the alternatives have these problems:

Hence, an overridable system was the compromise. It is similar to predefined mappings which also need to be set to null to remove them. I just missed adding it to register type.

In your use case, which-key should not be used for registering descriptions for Telescope mappings. It can parse descriptions directly from the mappings, and this is an issue with the Telescope module itself. I will make a PR to add those descriptions. At most, you should need to null out the +Telescope category label.

We can consider flipping the attribute set around and having +Telescope as the overridable but I am not sure if more people are interested in remapping or renaming the label itself.

Edit: Never mind, those are all sub categories.

diniamo commented 3 months ago

I'm not sure I understand all of those points, but yes, I also couldn't see a good way around this.

NotAShelf commented 3 months ago

binds are honestly a whole can of works that I'd rather not open right now

that doesn't hold this PR, however, so merging unless any objections arise