how to override existing map? #680
-
There is a scenario where I need to override the keymap. For example: lsp_map = {
{ "<Leader>f", "<cmd>lua vim.lsp.buf.format({ timeout_ms = 3000 })<CR>", desc = "Format document" },
}
user_map = {
{ "<Leader>f", "<cmd>lua require('telescope.builtin').commands() <CR>", desc = "Commands" },
}
wk = require("which-key") No matter the order: wk.add(lsp_map)
wk.add(user_map)
-- OR
wk.add(user_map)
wk.add(lsp_map) which-key always maps |
Beta Was this translation helpful? Give feedback.
Answered by
folke
Jul 14, 2024
Replies: 1 comment 2 replies
-
That's not correct. That's probably because LSP binds the keymaps in a buffer local keymaps and you don't. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you call add then you need to also add
buffer=the_buf_id
to properly override it