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.38k stars 177 forks source link

bug: typed letters that are part of a command map are not not showing in the command line #495

Closed sdondley closed 3 months ago

sdondley commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.9.0

Operating system/version

Alpine

Describe the bug

I'm attempting to create a map for command mode to fix a common typo I make: :wwq -> :wq

My config is as follows with lazy.nvim:

    opts = {
      triggers_blacklist = {
        --c = { "w" },
      },
      defaults = {
        ["wwq"] = {
          mode = "c",
          "<cmd>wq<cr>",
          "write and quit",
        },
    }

Note the triggers_blacklist is commented out above.

In this scenario, when I type "w", it does not show in the command line. When I type the second "w", it does not show either.

To attempt to fix this, I added the "triggers_blacklist" for the "w" key in command mode (shown above but commented out). Now the "w" prints, but the map no longer works unless I type it in quickly before the which-key kicks in. If I type in the map too slowly, the command is not recognized as a key map because it was blacklisted.

Steps To Reproduce

  1. Add code above

Expected Behavior

letter to show in command line when typing in map

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "folke/which-key.nvim", config = true },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
github-actions[bot] commented 4 months 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.