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

Feature Request: :checkhealth check for duplicate mappings #34

Closed
apppppppple opened this issue Apr 30, 2021 · 14 comments
Closed

Feature Request: :checkhealth check for duplicate mappings #34

apppppppple opened this issue Apr 30, 2021 · 14 comments

Comments

@apppppppple
Copy link
Contributor

I have my mappings separated into different files by plugin and right now if I overwrite one mapping with a different one it can be hard to tell that I did. I'd like to have a config option to enable checks for overriding mappings. If this is a feature you're okay with I'd be willing to do a pr for it.

@folke
Copy link
Owner

folke commented Apr 30, 2021

I actually added a checkhealth today that does some checks already. I can easily add in a dup check as well.

@folke
Copy link
Owner

folke commented Apr 30, 2021

But feel free to add a PR for this. Thanks!

@apppppppple
Copy link
Contributor Author

On second thought it might be better if you add it (if you're willing to and it's not too much work). I can't find where I should add it and I'm worried that I'd introduce a bug or some inconsistency.

@folke
Copy link
Owner

folke commented May 1, 2021

Added!

@ajitid
Copy link

ajitid commented May 1, 2021

Hey thanks for adding health check! I'm getting this error while running it:

image

(For some reason in my setup I wasn't able to copy text to clipboard so I had to upload an image instead.)

@apppppppple
Copy link
Contributor Author

Added!

Thanks a bunch! Sorry I chickened out

@apppppppple
Copy link
Contributor Author

Looks like I'm having the same error as zlksnk but on the upside, it only happens when there are duplicates so it still somewhat works

@folke
Copy link
Owner

folke commented May 1, 2021

Sorry about that. Fixed that nil error. It means you have a duplicate global mapping :)

@ajitid
Copy link

ajitid commented May 1, 2021

image

Ran checkhealth with latest which-key @folke and I'm getting a similar error, this time it received a string instead of nil. @apppppppple can you confirm?

@apppppppple
Copy link
Contributor Author

just checked and yep I'm getting the exact same thing

@folke
Copy link
Owner

folke commented May 1, 2021

My bad, but just fixed it. Think I need some sleep 😅

@folke
Copy link
Owner

folke commented May 1, 2021

It will show a message about buf=0, which is actually a global mapping.

@folke
Copy link
Owner

folke commented May 1, 2021

Still need to document what is being shown in healthcheck:

  • conflicting means a mapping existed for something where WK would normally create a trigger, but we didn't (in most cases not an issue)
  • overriding: this is because a mapping was registered that will override an existing one, which we did
  • local buffer keymaps overriding global ones are probably on purpose, so this will be a warning (should be ok)
  • keymaps overrriding other keymaps in the same buffer or global are probably not intended, so this will show as an error (probably not ok)

@apppppppple
Copy link
Contributor Author

My bad, but just fixed it. Think I need some sleep sweat_smile

Works perfectly now thanks!

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

3 participants