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.74k stars 154 forks source link

bug: does not work with cutlass.nvim #513

Open kevintraver opened 10 months ago

kevintraver commented 10 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.9.1

Operating system/version

MacOS 13

Describe the bug

Does not work with cutlass.nvim

https://github.com/gbprod/cutlass.nvim/issues/20

Steps To Reproduce

Install which-key.

Then pressing any pending operator mode keys should bring up which-key:

c, C, s, S, d, D, x, X, y

Expected Behavior

The which-key panel does not show up.

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",
  {
    "gbprod/cutlass.nvim",
    config = function()
      require("cutlass").setup()
    end,
  },
  { "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
sebastianst commented 10 months ago

Related to this, for me cutlass doesn't work at all if the which-key plugin is also enabled. The pop-ups of which-key show up, but the d and s bindings are just not set by cutlass. Seems like an ordering issue to me.

sebastianst commented 10 months ago

I think I found a workaround by setting the triggers_blacklist option of which-key to something like

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", "d", "D", "s", "S" },
            v = { "j", "k", "d", "D", "s", "S", " ", "g" },
            n = { "d", "D", "s", "S", "m" },
        }
gbprod commented 8 months ago

I've tried many things to fix this but nothing works :sweat:

github-actions[bot] commented 6 days 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.