diff --git a/lua/autocommands.lua b/lua/autocommands.lua index c4aaba1..00c3e99 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -1,5 +1,12 @@ local markdown = vim.api.nvim_create_augroup("markdown", { clear = true }) +local keyunmap = function(mode, binding) + print(vim.inspect(vim.fn.maparg(binding, mode))) + if vim.fn.maparg(binding, mode) ~= "" then + vim.keymap.del(mode, binding) + end +end + -- Recognize .md as pandoc vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { pattern = {"*.md", }, @@ -34,8 +41,8 @@ vim.api.nvim_create_autocmd({"OptionSet"}, { vim.keymap.set("n", "i", "mz[s1z=`z", {noremap = true, silent = true}) vim.keymap.set("n", "à", "]s", {noremap = true, silent = true}) else - vim.keymap.del("n", "i") - vim.keymap.del("n", "à") + keyunmap("n", "i") + keyunmap("n", "à") end end })