jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.09k stars 373 forks source link

On start issue #362

Open 7ijme opened 1 year ago

7ijme commented 1 year ago

Hey there,

I'm having an issue where if I press ; or / when I start neovim. I get this error. I have isolated the problem to this plugin, because when I delete it it doesn't error. When I do something first, like opening a file, it won' give me this error.

Error detected while processing function <lambda>261[1]..<SNR>96__open_win: line   22:
5555: API call: Vim(let):E716: Key not present in Dictionary: "rhs"

https://user-images.githubusercontent.com/68817281/226198754-b0bba11c-eded-4eb4-b540-b642d422e21a.mp4

LunarWatcher commented 1 year ago

Looks like <CR> is remapped, and maparg spews out something unexpected. There's probably an incompatible plugin. What's the output of imap <CR>?

7ijme commented 1 year ago

It's linked to cmp.utils.keymap.set_map from hrsh7th/nvim-cmp, which is required by VonHeikemen/lsp-zero.nvim. However, I have switched to cohama/lexima.vim which does the same thing as this and is compatible.

LunarWatcher commented 1 year ago

If a different plugin has the same problem, then it's not auto-pairs' or lexima's fault. It's either the other plugin, or your version of nvim interacting weirdly with maparg

LunarWatcher commented 1 year ago

Relevant neovim bug: https://github.com/neovim/neovim/issues/23666 Extended debugging over in my fork: https://github.com/LunarWatcher/auto-pairs/issues/78

TL;DR: Lua mappings don't populate rhs (which is guaranteed populated by the docs), breaking compatibility with auto-pairs