Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Hint window does not open for keys mapped to <C-w> #929

Open
4 tasks done
Crdr0122 opened this issue Jan 12, 2025 · 0 comments
Open
4 tasks done

bug: Hint window does not open for keys mapped to <C-w> #929

Crdr0122 opened this issue Jan 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Crdr0122
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.3

Operating system/version

Linux 6.6.58 #1-NixOSx86_64 GNU/Linux

Describe the bug

After mapping a key to (in my case it is "s") using nnoremap s <C-w> , said key cannot open hint window.
Adding this key or <C-w> into triggers manually does not open it either.

If I use proxy = "<C-w>" to achieve this, the window can open.
But since the preset builtin does not contain all the bindings, keybindings such as sH do not work unless I manually add whichkey.add{{"<C-w>H"}} into the whichkey.

Steps To Reproduce

  1. Add nnoremap s <C-w> or vim.keymap.set("n", "s", "<C-w>") into config file
  2. Press s, observe that ^W appears in right bottom corner but hint window does not pop up
  3. The same thing happens even if
{ "s",      mode = { "x", "n" } },
{ "<C-w>",  mode = { "n", "x" } },

is added into triggers

Expected Behavior

I expect that the hint window will pop up, especially if I add the manual triggers for the keys.
Or that proxy can proxy my key to <C-w> completely and allow bindings not listed in the preset to be directly used as well.

Health

No response

Log

No response

Repro

vim.keymap.set("n", "s", "<C-w>")
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/which-key.nvim",
      opts = {
        triggers = {
          { "<auto>", mode = "nixsotc" },
          { "s",      mode = "nixsotc" },
          { "s",      mode = { "x", "n" } },
          { "<C-w>",  mode = { "n", "x" } },
          { "<C-w>",  mode = "nixsotc" },
        }
      },
    },
  }
})
@Crdr0122 Crdr0122 added the bug Something isn't working label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant