which-key.nvim
which-key.nvim copied to clipboard
which-key hijacks my `h` key
For some reason, I'm not able to use my h
key in normal mode any longer. On further investigation, I ran :map
and noticed that which-key
has remapped it to:
n h * <Cmd>lua require("which-key").show("h", {mode = "n", auto = true})<CR>
Any particular reason for this? And can I have my h
key back, please?
Ah, I may have solved this myself. I've added h
to the triggers_blacklist
in normal mode. That seems to have cleared up the issue.
The only reason I can think of, is that you have a mapping under h
? So a mapping that starts with h
Indeed, I do. I set up all my mappings like this. In this case, as all my h
mappings live under this h
scope, I should have foreseen this issue. The blacklist approach above works well enough for my needs.
-- Hop
wk.register({
h = {
name = 'Hop',
l = { ':HopLine<CR>', 'Jump to visible line' },
p = { ':HopPattern<CR>', 'Jump to pattern' },
w = { ':HopWord<CR>', 'Jump to word' },
}
}, { mode = 'n', prefix = '<leader>' })
Similar behavior happens in another very real-life config when using 'vim-sandwich'-like functionality (mapped to sa
, sd, etc.) and having
nnoremap s <Nop>. So with the example config hitting
s;will act as default substitute command instead of acting as
;. Without 'which-key' everything works as expected (
saand
sdwork from maps,
sworks as
Example config:
lua require('which-key').setup({})
nnoremap s <Nop>
nnoremap sa :echo 'Add'<CR>
nnoremap sd :echo 'Delete'<CR>
Putting n = {'s'}
to triggers_blacklist
works but leads to not displaying possible options sa
and sd
.
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.