which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

which-key popup when yank/delete/cut "x" times

Open sergiza opened this issue 2 years ago • 9 comments

I don't know if it is intended, but for example when you do y4 you get the which-key popup.

That seems like a regular command to me that doesn't require the which-key popup. Any way to disable it in case it is intended?

sergiza avatar Jul 04 '23 15:07 sergiza

Was going to make the same issue. Writing d2d will immediately pop up the which-key dialog as soon as 2 is pressed, even if I set the timeoutlen and ttimeoutlen to be > 1000. It can be pretty distracting

ColinKennedy avatar Jul 05 '23 01:07 ColinKennedy

Thank you for the link. That fixed it

local which_key = require("which-key")

which_key.setup {
    plugins = {
        presets = {
            operators = false,
        }
    }
}

which_key.register(
    {
        -- more stuff
    }
)

Now I've got it all working. No unnecessary pop up with custom pop-up messages. Thank you!

ColinKennedy avatar Jul 09 '23 18:07 ColinKennedy

How to disable pop-up only for when I hit these keys?

For example, I want to allow pop-up when I run :WhichKey or . otherwise I wanna prevent from showing app automatically (If possible, disable pressing to show up only for certain keys such as v, d, y) .

MKrbm avatar Aug 11 '23 15:08 MKrbm

@MKrbm You can use the triggers options:

  triggers = "auto", -- automatically setup triggers
  -- triggers = {"<leader>"} -- or specifiy a list manually
  -- list of triggers, where WhichKey should not wait for timeoutlen and show immediately
  triggers_nowait = {
    -- marks
    "`",
    "'",
    "g`",
    "g'",
    -- registers
    '"',
    "<c-r>",
    -- spelling
    "z=",
  },
  triggers_blacklist = {
    -- list of mode / prefixes that should never be hooked by WhichKey
    -- this is mostly relevant for keymaps that start with a native binding
    i = { "j", "k" },
    v = { "j", "k" },
  },

Pagliacii avatar Aug 12 '23 02:08 Pagliacii

Thank you for the help!

MKrbm avatar Aug 13 '23 11:08 MKrbm

Sorry if I'm missing something, but I thought the idea of the timeout is to control how the which-key popup appears depending on whether the user wants or does not want help.

For example, if I type d3w quickly, I don't want help and don't want the popup. But if I type d and wait x ms, I want to see the popup to find out what the options are from there.

How can I achieve this?

The suggestion above just removes the popup for operators altogether - not useful unless I know all the motions - but with it on, as soon as I enter a [count] the popup appears no matter how quickly I complete the sequence and no matter what the timeout setting.

qgates avatar Aug 21 '23 20:08 qgates

@qgates You can use this option to disable the popup for [count] part:

  motions = {
    count = true,
  },

Pagliacii avatar Aug 22 '23 14:08 Pagliacii

@Pagliacii that helps as a workaround, thank you!

I do feel however that this is all a bit 'messy'. It would be more consistent if which-key had it's own timer allowing it to pop up help if we're partway through a operator-count-motion (or other supported sequence) and pause before completion, or to use timeoutlen to that end more intuitively. Without diving into the code I'm not sure that either is straightfoward or even possible; perhaps this is a feature request rather than a bug.

I'm not sure why the popup appears the moment we choose a count by default. That behaviour seems jarring - the (unwanted) popup flashes during quick sequences.

nb. as an aside, I've always found vim's design, of waiting indefinitely when the user is partway through an action like d2, to be obtuse. If we get interrupted by a phone call we return to vim in an unusual state. There are some visual cues - d2 below the status bar and the text cursor changing - but it's not exactly obvious. Such situations should timeout and reset after a period, imo.

qgates avatar Aug 22 '23 20:08 qgates

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.

github-actions[bot] avatar Jul 06 '24 01:07 github-actions[bot]