Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org_meta_return doesnt jump below heading content #775

Open
ir-ae opened this issue Jul 17, 2024 · 4 comments · May be fixed by #822
Open

org_meta_return doesnt jump below heading content #775

ir-ae opened this issue Jul 17, 2024 · 4 comments · May be fixed by #822
Labels
bug Something isn't working

Comments

@ir-ae
Copy link

ir-ae commented Jul 17, 2024

Describe the bug

org_mappings.meta_return doesnt skip past the contents of the heading

Steps to reproduce

  1. Position cursor on line with heading and multiple lines of content
* Heading | <- Put cursor here
Line 1
Line 2
  1. 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:
nvim

In Emacs:
emacs

OS / Distro

Windows 10

Neovim version/commit

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068

Additional context

No response

@ir-ae ir-ae added the bug Something isn't working label Jul 17, 2024
BreitbandModem pushed a commit to BreitbandModem/orgmode that referenced this issue Oct 27, 2024
BreitbandModem pushed a commit to BreitbandModem/orgmode that referenced this issue Oct 28, 2024
@kristijanhusak
Copy link
Member

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.

@BreitbandModem
Copy link
Contributor

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..)

@kristijanhusak
Copy link
Member

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.

@BreitbandModem
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants