Closed cyruseuros closed 4 days ago
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
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.
@folke, this issue is closed? does that mean for remappings like this, which-key works out of the box? that is not the behavior I can see, though.
nmap <leader>w <c-w>
for example works
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!