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
5.12k stars 163 forks source link

feature: which-key.show overrides a deactivated mode #677

Closed Fabian-programmer closed 1 month ago

Fabian-programmer commented 1 month ago

Did you check the docs?

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

See: https://github.com/folke/which-key.nvim/issues/656#issuecomment-2226977479

Maybe I had other intentions than the author, but in v2.1.0 you were able to select lines/block, without the which-key popup. Only when you pressed an additional key, like leader or g, the popup showed up. Is this possible with v3? I really liked this behaviour, because this made yanking/pasting/cutting text less distracting. Still thank you for the great plugin :)

Describe the solution you'd like

Hey, I'd come up with an idea of the mentioned issue:

Disabling the visual mode within the configuration, but still having a keymapping, which shows the keys with require("which-key").show({ global = true }). (see configuration)

This would solve for me both problems. No more distracting popup in visual mode, but still having the option to open the which-key popup, when I have to look up some keymappings.

The current problem is, that disabling visual mode makes the key binding unusable in that mode. I'm not sure, if this is 1. intendent and 2. solvable with the current architecture, but would have in my eyes a huge benefit in usability, because the user can work with which-key on-demand and is not bound on the scope of a mode.

Configuration:

  {
    "folke/which-key.nvim",
    event = "VeryLazy",
    opts = {
      modes = {
        x = false, -- Visual mode
      },
    },
    keys = {
      {
        "<leader>?",
        function()
          require("which-key").show({ global = true })
        end,
        desc = "Keymaps",
        mode = { "n", "v" },
      },
    },
  },

Describe alternatives you've considered

no alternative

Additional context

No response

folke commented 1 month ago

Closing in favor of #690