which-key.nvim
which-key.nvim copied to clipboard
Key aliases
If keys are aliased to each other (e.g. wk.register('<leader>w', '<c-w>')
), which-key should reuse mappings automatically.
Thank you for an amazing plugin!
Same here trying to achieve the same, I'm trying to not duplicate the existing keybindings for <C-w>
w = { "<c-w>", "<C-W>", noremap = false },
Same problem, I'm using this now, but this still has the problem of having to wait a while for the prompt to appear, is there a better way to do this?
Same here trying to achieve the same, I'm trying to not duplicate the existing keybindings for
<C-w>
vim.g.WK_shown = false
local function wk_alias(keys)
local timeout = vim.o.timeoutlen
if vim.g.WK_shown then
vim.o.timeoutlen = 0
end
local key_codes = vim.api.nvim_replace_termcodes(keys, true, false, true)
vim.api.nvim_feedkeys(key_codes, "m", false)
local timer = vim.loop.new_timer()
if timer == nil then
return nil
end
timer:start(
5,
0,
vim.schedule_wrap(function()
vim.o.timeoutlen = timeout
vim.g.WK_shown = false
end)
)
end
vim.api.nvim_create_autocmd({ "Filetype" }, {
pattern = "WhichKey",
callback = function()
vim.g.WK_shown = true
end,
})
wk.register({
...
w = {
function()
wk_alias("<c-w>")
end,
"+window",
name = "",
},
...
})
I found the almost perfect solution