Description
Describe the bug
Under some conditions, pressing <CR>
in insert mode results in the following message:
[orgmode] Invalid 'keys': Expected Lua string
The editor then hangs until ctrl-c is pressed, which will interrupt a call to vim.cmd[[redraw!]]
.
As far as I can tell, this is caused by these lines in the org_return
action handler:
orgmode/lua/orgmode/org/mappings.lua
Lines 574 to 593 in 0683da9
In cases where this bug occurs, b:org_old_cr_mapping
has a field callback
but no field rhs
. The fallback then correctly calls callback()
. However, it seems the return value is unconditionally passed to nvim_feedkeys()
, even if eval
is false and the return value is, say, nil
.
This should be easily fixable and I wouldn't mind submitting a PR. I'd just like someone who knows the code to look over it and make sure my train of thought is correct.
Steps to reproduce
Not quite clear what is necessary. I think this is caused by orgmode setting up its imap <CR> ...
after nvim-cmp has set up its imap <CR>
. Lazy-loading makes this trigger reliably, but it should be possible to hit this with eager loading, too.
Expected behavior
No error message, org_return
forwards <CR>
to nvim-cmp, which then falls back to a regular line break.
Emacs functionality
No response
Minimal init.lua
N/A
Screenshots and recordings
No response
OS / Distro
Fedora 40
Neovim version/commit
0.10.1
Additional context
No response