dstein64 / nvim-scrollview

A Neovim plugin that displays interactive vertical scrollbars and signs.
MIT License
517 stars 9 forks source link

Bug: keymaps created by plugin should should be omitted from whichkey #97

Closed chrisgrieser closed 1 year ago

chrisgrieser commented 1 year ago

For keymaps created by this plugin, e.g. for z{letter}, the plugins does clutter up whichkey.nvim: CleanShot 2023-06-09 at 20 56 44@2x

The problem should pretty easy to fix though, since the keymap just needs to use desc = "which_key_ignore", see: https://github.com/folke/which-key.nvim/issues/391

dstein64 commented 1 year ago

I just added an experimental config variable, scrollview_refresh_mapping_desc, that can be used to set the desc field of the plugin's refresh mappings.

For your use case, it sounds like you'd want something like the following:

Vimscript

let g:scrollview_refresh_mapping_desc = 'which_key_ignore'

Lua config variable

vim.g.scrollview_refresh_mapping_desc = 'which_key_ignore'

Lua setup call

require('scrollview').setup({
  ...
  refresh_mapping_desc = 'which_key_ignore',
  ...
})
chrisgrieser commented 1 year ago

Thanks, this works!

I'm only wondering: Is there any reason why I would want to give the refresh mappings a different description? I cannot really think of one, and in this case, there isn't really a need for configuring this by the user? 🤔

dstein64 commented 1 year ago

Making this configurable was done for the following reasons:

  1. In case there are other similar plugins (or other similar plugins in the future) that need similar handling.
  2. In case users don't want the update (I'm not a user of which-key, so I don't know whether that's the case).
  3. As a precaution in case the desc field is used differently for other purposes. The documentation describes it as a "human readable description", so fixing it at "which_key_ignore" would not follow its documented purpose.