mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
fix(inc-selection): handle deleting non-existing keymaps
This commit is contained in:
parent
140a486abe
commit
4fbf150a16
1 changed files with 4 additions and 4 deletions
|
|
@ -155,10 +155,10 @@ function M.detach(bufnr)
|
||||||
local config = configs.get_module "incremental_selection"
|
local config = configs.get_module "incremental_selection"
|
||||||
for f, mapping in pairs(config.keymaps) do
|
for f, mapping in pairs(config.keymaps) do
|
||||||
if mapping then
|
if mapping then
|
||||||
if f == "init_selection" then
|
local mode = f == "init_selection" and "n" or "x"
|
||||||
vim.keymap.del("n", mapping, { buffer = bufnr })
|
local ok, err = pcall(vim.keymap.del, mode, mapping, { buffer = bufnr })
|
||||||
else
|
if not ok then
|
||||||
vim.keymap.del("x", mapping, { buffer = bufnr })
|
utils.notify(string.format('%s "%s" for mode %s', err, mapping, mode), vim.log.levels.ERROR)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue