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.99k stars 160 forks source link

bug: Remapped registers key doesn't trigger which-key #537

Closed happenslol closed 3 weeks ago

happenslol commented 9 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.9.4

Operating system/version

NixOS 23.11.20231024.8efd5d1

Describe the bug

I've remapped my registers key to ', and I can't get which-key to trigger when pressing it.

I've already looked at #483, where the following was suggested:

{
  'folke/which-key.nvim',
  config = function()
    local actions = require("which-key.plugins.registers").actions
    table.insert(actions, { ... }) -- Add remapped triggers here
    require("which-key").setup()
  end,
}

This does not do anything for me. I've included this as a step in the reproduction below.

Steps To Reproduce

  1. Remap the registers key
vim.keymap.set({ "n", "v" }, "'", "\"")
  1. Apply the fix suggested in #483
{
  "folke/which-key.nvim",
  config = function(_, opts)
    -- Show registers when pressing remapped ' key
    local registers_actions = require("which-key.plugins.registers").actions
    table.insert(registers_actions, { trigger = "'", mode = "n" })
    table.insert(registers_actions, { trigger = "'", mode = "v" })
    require("which-key").setup()
  end,
},
  1. Press '

Expected Behavior

The registers which-key window should show, but nothing happens. The window still shows when pressing ".

Repro

No response

bommbo commented 8 months ago

You can try it like that, but it is not possible to remap the character "\"" to "'".

    keys = {
      { "'", "\"", desc = "keyremap", mode = { "n", "v" }, remap = true },}
github-actions[bot] commented 1 month 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.

happenslol commented 1 month ago

Not stale, still relevant