Skip to content

Commit 2cb04d7

Browse files
Übertreiberbroken-pen
andauthored
Handle org_return correctly in face of Lua keymaps (#548)
Co-authored-by: Nico Madysa <[email protected]>
1 parent d8020e9 commit 2cb04d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/orgmode/org/mappings.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,17 @@ function OrgMappings:org_return()
507507

508508
local old_mapping = config.old_cr_mapping
509509

510+
-- No other mapping for <CR>, just reproduce it.
510511
if not old_mapping or vim.tbl_isempty(old_mapping) then
511512
return vim.api.nvim_feedkeys(utils.esc('<CR>'), 'n', true)
512513
end
513514

515+
-- Lua mapping that installed a Lua function to call.
516+
if old_mapping.callback then
517+
return old_mapping.callback()
518+
end
519+
520+
-- Classic, string-based mapping. Reconstruct it as faithfully as possible.
514521
local rhs = utils.esc(old_mapping.rhs)
515522

516523
if old_mapping.expr > 0 then

0 commit comments

Comments
 (0)