Skip to content

Commit 02d9799

Browse files
Fix fallback <CR> mapping when mapped to script level mapping. Closes #327
1 parent 3531edc commit 02d9799

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/orgmode/org/mappings.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,16 @@ function OrgMappings:org_return()
449449

450450
local rhs = config.old_cr_mapping.rhs
451451

452+
if config.old_cr_mapping.script > 0 then
453+
rhs = rhs:gsub('<SID>', string.format('<SNR>%d_', config.old_cr_mapping.sid))
454+
if rhs:match('^<CR>') then
455+
rhs = rhs:gsub('<CR>', '')
456+
vim.api.nvim_feedkeys(utils.esc('<CR>'), 'n', true)
457+
end
458+
459+
return vim.api.nvim_feedkeys(utils.esc(rhs), '', true)
460+
end
461+
452462
if config.old_cr_mapping.expr > 0 then
453463
rhs = vim.api.nvim_eval(rhs)
454464
end

0 commit comments

Comments
 (0)