Julian / lean.nvim

Neovim support for the Lean theorem prover
MIT License
276 stars 26 forks source link

Abbreviation mappings are broken in the presence of user mappings which are lua callbacks #270

Closed Julian closed 2 years ago

Julian commented 2 years ago

vim.fn.maparg now can return mappings that have no rhs (and instead are a lua callback).

Given a mapping to e.g. <CR>, this makes abbreviation expansion raise errors as it tries to reset a mapping which vim.fn.maparg doesn't know how to deal with.

Screen Shot 2022-08-22 at 09 17 34

We need to instead use vim.api.nvim_buf_get_keymap, which is slightly clunky (and returns all mappings rather than mappings for just a specific key), but which will return a table with callback (the lua callback) for mappings that don't have RHSs.