-
-
Notifications
You must be signed in to change notification settings - Fork 150
feat: Allow hiding mappings from the help panel #278
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
Conversation
|
@fjchen7 Thanks for the PR! I'm missing some explanation for this change. What's the point of hiding entries from the help panel? |
|
The final purpose is to make help panel cleaner if users want. For me the specific requirement is: require("diffview").setup {
keymaps = {
file_panel = {
-- I don't want to show some conventional keymaps
{ "n", "j", actions.next_entry, { desc = false } },
{ "n", "<down>", actions.next_entry, { desc = false } },
{ "n", "k", actions.prev_entry, { desc = false } },
{ "n", "<up>", actions.prev_entry, { desc = false } },
-- I want to disable some keymaps without showing them in the help panel.
{ "n", "<C-o>", "", { desc = false } }, -- Avoid accidentally messing up buffer
{ "n", "<C-i>", "", { desc = false } },
}
}
} |
sindrets
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the desc field to anything other than a string is unintended usage of the nvim_set_keymap() API. While it seems to have no side effects right now; there's no guarantee it will stay that way in the future. We need to do this properly and special-case this behavior in the plugin's keymap processing.
You can check here whether the desc field has been set to false, and if so, change the value of the expanded mapping to __DIFFVIEW_IGNORED__ or something.
|
Of we directly choose the special string like For example, { "n", "<2-LeftMouse>", actions.select_entry, { desc = "__DIFFVIEW_IGNORED__" } },In my opinion, this could avoid conflict with the extension about |
|
@fjchen7 good call. Let's just go with |
sindrets
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
No description provided.