folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
4.99k stars 160 forks source link

feature: Disable which-key UI #548

Closed s1n7ax closed 3 weeks ago

s1n7ax commented 8 months ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

I do Youtube videos and in videos which-key popup looks like screen flicker when keymaps are executed fast. Such as dhf I use to delete inside function. When timeoutlen is set to a long time like 3000ms and press d it wait's 3000ms to show up but If I do dh popup shows up immediately.

vim.o.timeout = true
vim.o.timeoutlen = 3000

I obviously want all the keymaps to be added through which-key. However, I want to temporary disable the UI popup.

Describe the solution you'd like

A WhichKeyDisableUI WhichKeyEnableUI & WhichKeyToggleEnableUI commands to enable disable UI

Describe alternatives you've considered

Could not find a way to disable UI.

Additional context

This is how the keymaps has been registered through lazy.nvim

return {
  'nvim-treesitter/nvim-treesitter',
  opts = {
    textobjects = {
      select = {
        enable = true,
        lookahead = true,
        keymaps = {
          ['ak'] = { query = '@block.outer', desc = 'around block' },
          ['hk'] = { query = '@block.inner', desc = 'inside block' },
          ['ac'] = { query = '@class.outer', desc = 'around class' },
          ['hc'] = { query = '@class.inner', desc = 'inside class' },
          ['a?'] = {
            query = '@conditional.outer',
            desc = 'around conditional',
          },
          ['h?'] = {
            query = '@conditional.inner',
            desc = 'inside conditional',
          },
          ['af'] = {
            query = '@function.outer',
            desc = 'around function ',
          },
          ['hf'] = {
            query = '@function.inner',
            desc = 'inside function ',
          },
          ['al'] = { query = '@loop.outer', desc = 'around loop' },
          ['hl'] = { query = '@loop.inner', desc = 'inside loop' },
          ['aa'] = {
            query = '@parameter.outer',
            desc = 'around argument',
          },
          ['ha'] = {
            query = '@parameter.inner',
            desc = 'inside argument',
          },
        },
      },
    },
  },
}
realbogart commented 7 months ago

+1

I just found this issue while trying to find a way to toggle the UI. The plugin is really helpful when I need it, but distracting when it pops up accidentally. I would like to explicitly toggle it on when I need it.

Thanks for a great plugin!

dvalnn commented 6 months ago

+1 I have also struggled with this. When i cannot remember a particular key combination this plugin is amazing, however most of the time i do not have the need for it to show up and i find that just setting up a bigger timeout delay is not the optimal solution.

Great plugin either way!

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.