which-key.nvim icon indicating copy to clipboard operation
which-key.nvim copied to clipboard

can't remap 'z=' to open a which-key menu

Open tiyn opened this issue 2 years ago • 3 comments

I'm currently trying to map the which-key menu that opens when you press z= to another key combination. If I try to remap it by mapping another keycombination to trigger z= then it'll open the default z= window and not the which-key menu. Is there a way to remap only the which-key z= menu?

tiyn avatar Apr 03 '24 01:04 tiyn

Nevermind, I just found the correct way to do it. For anyone using mapx - it looks like the following:

local m = require("mapx").setup({ global = true, whichkey = true })
m.nmap("<F6>s", "z=", "Spell: display suggestions")

tiyn avatar Apr 03 '24 01:04 tiyn

Had the same issue, but wasn't using mapx. This worked for me:

vim.keymap.set('n',
  '<leader>zz',
  '<cmd>WhichKey<cr>z=',
  { noremap = true, desc = 'Open Spell Suggest Picker (z= alias)' })

Craftidore avatar Jun 01 '25 23:06 Craftidore

I was also struggling with this and based on your solution I adapted it to the way the plugin does the Mappings

local wk = require("which-key")
wk.add({
  {
    "zz",
    "<cmd>WhichKey<cr>z=",
    noremap = true,
    desc = "Spelling Suggest (z= alias)",
    icon = { icon = "î¾³ ", color = "red" },
  },
})

m1zp avatar Nov 10 '25 13:11 m1zp