I am using neovim with the VimTeX plugin. The plugin creates many keybinds to help with writing in LaTeX, but some of the insert mode keybinds just get in my way, so I want to disable them. As an example, ]]
is a keybind in insert mode that closes whatever environment you are currently in. In insert mode, it calls the function <plug>(vimtex-delim-close)
.
I’ve tried putting vim.api.del("i", "]]")
in my init.lua
file, but that broke my config completely, giving the following message:
Error detected while processing /home/ea/.dotfiles/.config/nvim/init.lua:
E5113: Error while calling lua chunk: vim/keymap.lua:0: E31: No such mapping
stack traceback:
[C]: in function 'nvim_del_keymap'
vim/keymap.lua: in function 'del'
/home/ea/.config/nvim/lua/keymaps.lua:109: in main chunk
[C]: in function 'require'
/home/ea/.dotfiles/.config/nvim/init.lua:17: in function 'reqs'
/home/ea/.dotfiles/.config/nvim/init.lua:21: in main chunk
Press ENTER or type command to continue
From there, I created ~/.config/nvim/after/ftplugin/tex.lua
with the line vim.api.del("i", "]]")
in it, but it doesn’t do what I want it to do. I have confirmed that the file is being sourced properly by adding other keybinds to test, and they work as expected. The interesting part is that putting the line in my after/tex.lua
file didn’t break my config the same way putting it in init.lua
did, so maybe the keybind does exist at the point where after/tex.lua
is being sourced, but just isn’t being deleted properly?