diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/incremental_selection.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lua/nvim-treesitter/incremental_selection.lua b/lua/nvim-treesitter/incremental_selection.lua index f6f8fb266..78f0915c8 100644 --- a/lua/nvim-treesitter/incremental_selection.lua +++ b/lua/nvim-treesitter/incremental_selection.lua @@ -155,10 +155,10 @@ function M.detach(bufnr) local config = configs.get_module "incremental_selection" for f, mapping in pairs(config.keymaps) do if mapping then - if f == "init_selection" then - vim.keymap.del("n", mapping, { buffer = bufnr }) - else - vim.keymap.del("x", mapping, { buffer = bufnr }) + local mode = f == "init_selection" and "n" or "x" + local ok, err = pcall(vim.keymap.del, mode, mapping, { buffer = bufnr }) + if not ok then + utils.notify(string.format('%s "%s" for mode %s', err, mapping, mode), vim.log.levels.ERROR) end end end |
