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: Disable which-key when first time get into visual mode #656

Closed dragove closed 1 month ago

dragove commented 1 month ago

Did you check the docs?

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

when entering visual mode use v or V, which-key show up and <Esc> should be pressed twice to exit visual mode

Describe the solution you'd like

disable which-key when enter visual mode or we can use <Esc> to exit visual mode when which-key showed

Describe alternatives you've considered

I have no idea

Additional context

No response

folke commented 1 month ago

you can disable any mode. please check the docs

Fabian-programmer commented 1 month ago

@folke do you refer to:

 -- Enable/disable WhichKey for certain mapping modes
  modes = {
    n = true, -- Normal mode
    i = true, -- Insert mode
    x = true, -- Visual mode
    s = true, -- Select mode
    o = true, -- Operator pending mode
    t = true, -- Terminal mode
    c = true, -- Command mode
  },

?

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 :)

folke commented 1 month ago

ok, I'll see if I can add this

niba commented 1 month ago

I've checked and noticed a change in behavior.

In the old version of which-key

  1. Press v
  2. Get which-key help
  3. Press esc
  4. You are back to normal mode

In which-key v3

  1. Press v
  2. Get which-key help
  3. Press esc
  4. You are still in visual mode

The old one was much better, is it possible to bring it back?

folke commented 1 month ago

Op's issue is fixed.

As for @Fabian-programmer I'm afraid that's not that simple anymore. v2 created real keymaps for v and V and friends. v3 no longer does that and hooks into ModeChanged to show which-key.

There are no trigger either for operator pending keymaps like i or a.

So while I technically could disable showing in ModeChanged, you wouldn't be able to trigger which-key next with i etc.