org_meta_return doesnt jump below heading content
Describe the bug
org_mappings.meta_return doesnt skip past the contents of the heading
Steps to reproduce
- Position cursor on line with heading and multiple lines of content
* Heading | <- Put cursor here
Line 1
Line 2
- Call org_mappings.meta_return with the keymap in the minimal_repro
Expected behavior
Heading content should be skipped past
Emacs functionality
Behaves as expected in Emacs
Minimal init.lua
local tmp_dir = vim.env.TMPDIR or vim.env.TMP or vim.env.TEMP or '/tmp'
local nvim_root = tmp_dir .. '/nvim_orgmode'
local lazy_root = nvim_root .. '/lazy'
local lazypath = lazy_root .. '/lazy.nvim'
-- Install lazy.nvim if not already installed
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git' })
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{
'nvim-orgmode/orgmode',
event = 'VeryLazy',
ft = { 'org' },
config = function()
require('orgmode').setup()
end,
},
}, {
root = lazy_root,
lockfile = nvim_root .. '/lazy.json',
install = {
missing = false,
},
})
require('lazy').sync({
wait = true,
show = false,
})
vim.keymap.set('i', '<C-CR>', function ()
require"orgmode".action("org_mappings.meta_return")
end, { buffer = true })
Screenshots and recordings
In nvim-orgmode:
In Emacs:
OS / Distro
Windows 10
Neovim version/commit
NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068
Additional context
No response
By default, meta_return does not skip the content.
It does that only if you do a <C-u> before that in Emacs, as stated in the manual:
Calling the command with a C-u prefix unconditionally inserts a new heading at the end of the current subtree, thus preserving its contents. With a double C-u C-u prefix, the new heading is created at the end of the parent subtree instead.
We do not have those prefix dependent actions since it's tricky to handle it.
The Ctrl+Return does what you are mentioning (https://orgmode.org/manual/Structure-Editing.html#index-C_002dRET), and that is mapped to <leader>oih by default.
That's interesting, thanks for sharing the original orgmode docs!
(Also, I wasn't really aware of the <leader>oih. Will use it for now then..)
I guess that maybe the confusion of this issue might come from the fact that in doom-emacs, the meta-return is actually mapped to the ctrl-return. ..Which, for me personally, also feels way more intuitive.
But then I assume the goal of this project is to adhere to the original / vanilla emacs orgmode? (To be very nitpicky, the current meta return implementation in nvim-orgmode doesn't match exactly with the vanilla emacs meta return. But tbh I wouldn't be motivated to align it as I don't think it's intuitive anyways..)
But then I assume the goal of this project is to adhere to the original / vanilla emacs orgmode?
Yes, that's true. It's hard to keep it 1 to 1 though.
To be very nitpicky, the current meta return implementation in nvim-orgmode doesn't match exactly with the vanilla emacs meta return
Can you provide details on this? I'm aware of the empty line between the headlines when you press it, that should be configurable, but besides that I think it works as emacs.
Can you provide details on this? I'm aware of the empty line between the headlines when you press it, that should be configurable, but besides that I think it works as emacs.
Looking at the documentation you linked (again, seems different from doom), most of the things are slightly different:
If the command is used at the beginning of a line, and if there is a heading or a plain list item (see Plain Lists) at point, the new heading/item is created before the current line.
nvim: new heading/item is created after the current line.
When used at the beginning of a regular line of text, turn that line into a heading.
nvim: nothing happens in this case.
When this command is used in the middle of a line, the line is split and the rest of the line becomes the new item or headline. If you do not want the line to be split, customize org-M-RET-may-split-line.
nvim: same action as when used in the beginning of the line (or maybe if org-M-RET-may-split-line is set accordingly).
Calling the command with a C-u prefix unconditionally inserts a new heading at the end of the current subtree, thus preserving its contents.
nvim: available as <leader>oih.
With a double C-u C-u prefix, the new heading is created at the end of the parent subtree instead.
nvim: not sure if this exists.