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

Discussion: home-manager plugins, can randomly and silently shadow other plugin´s keybindings #12

Open
haennes opened this issue Jan 20, 2025 · 1 comment

Comments

@haennes
Copy link
Contributor

haennes commented Jan 20, 2025

Note

This relies on #9 being merged!

Problem

If two plugins bind an action to the same key, a random one takes precedence. (This can be solved by setting the respective key option)

Example:
https://github.com/haennes/nix-yazi-plugins/blob/fg/plugins/fg/hm-module.nix

https://github.com/haennes/nix-yazi-plugins/blob/wip/plugins/jump-to-char/hm-module.nix

Proposed Solutions

Warnings

iterate over all set keys, and throw a warning if we detect such a collision

Pros

  • we dont prohibit undefined behaviour???

Cons

  • a bit tricky to implement, should really be done by some nix builtin feature

Implementing our own options for yazi using attrsets

make programs.yazi.yaziPlugins.{keys, previewers, ...} options that are of type attrsOf submodule
names of these attrs being:

  • key (sequence) encoded as string encoded
    • prepend / append could be stored inside the value
  • mime-type (previewers)
  • file type (previewers)

Pros

  • the nix modules system handles collisions

Cons

  • possibly hard to maintain, as every upstream change to the config format needs to be reflected

Leave as is and mention it in the README

This is also a valid solution

@lordkekz
Copy link
Owner

I have a relevant PR in the home-manager upstream since this check isn't specific to plugins and we don't currently maintain our own options for setting keymaps etc.
nix-community/home-manager#6343

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

2 participants