Skip to content

bug: proxy does not respect noremap #1056

Description

@drewlwhitney

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)

v0.12.2

Operating system/version

Archlinux

Describe the bug

The proxy option in wk.add() does not respect noremap, which causes conflicts when remapping <C-w>.

Steps To Reproduce

  1. Inside require("which-key").add({})
    1. Add { "<C-w>", "<C-w>q", noremap = true }
    2. Add { "<leader>w", proxy = "<C-w>", noremap = true }
  2. Run nvim
  3. Type <leader>w
  4. The current buffer closes

Expected Behavior

Because noremap is set, the proxy should directly send <C-w> to vim instead of going through the { "<C-w>", "<C-w>q", noremap = true } mapping

Health

- ✅ OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON'T| report these warnings as an issue.

Checking your config ~
- ⚠️ WARNING |mini.icons| is not installed
- ✅ OK |nvim-web-devicons| is installed

Checking for issues with your mappings ~
- ✅ OK No issues reported

checking for overlapping keymaps ~
- ⚠️ WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- ✅ OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- ✅ OK No duplicate mappings found

Log

n/a

Repro

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 = {} },
    },
})

require("which-key").add({
    { "<C-w>",     "<C-w>q",        noremap = true },
    { "<leader>w", proxy = "<C-w>", noremap = true },
})

-- this is just what I use
vim.g.mapleader = " "

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions