Skip to content

Improve org_meta_return coherence on lists #858

Open
@lyz-code

Description

@lyz-code

Describe the bug

I feel that the current behaviour of org_meta_return on lists and checklists is really org_insert_heading_respect_content.

Steps to reproduce

So for example if we have the next file:

* Heading 1  <-- cursor here
  SCHEDULED: <2025-01-18>

If you press org_meta_return you get:

* Heading 1  
* <-- cursor here
  SCHEDULED: <2025-01-18>

If you press org_insert_heading_respect_content you get:

* Heading 1
  SCHEDULED: <2025-01-18>
  
* <-- cursor here

However if you have the next file:

* Heading 1
  - Line 1 <-- cursor here
    - Subline 1

If you press org_meta_return you get:

* Heading 1
  - Line 1
    - Subline 1
  - <-- cursor here

Which is closer to org_insert_heading_respect_content than org_meta_return as it respects the content

Expected behavior

From this file:

* Heading 1
  - Line 1 <-- cursor here
    - Subline 1

If you press org_meta_return you should get:

* Heading 1
  - Line 1
  -  <-- cursor here
    - Subline 1

If you press org_insert_heading_respect_content you get:

* Heading 1
  - Line 1
    - Subline 1
  - <-- cursor here

For me this change would be important because I use more often org_insert_heading_respect_content when dealing with headlines than org_meta_return so it would be a better ux experience for me to use the same key binding for what I'd expect on lists and checklists

Emacs functionality

No response

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"

for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = nvim_root .. "/" .. name
end

-- 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",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		"nvim-orgmode/orgmode",
		event = "VeryLazy",
		ft = { "org" },
		config = function()
			require("orgmode").setup({
				org_agenda_files = {
					"*.org",
				},
				mappings = {
					capture = {
						org_capture_finalize = "<c-s>",
					},
				},
			})
		end,
	},
}, {
	root = lazy_root,
	lockfile = nvim_root .. "/lazy.json",
	install = {
		missing = false,
	},
})

require("lazy").sync({
	wait = true,
	show = false,
})

Screenshots and recordings

No response

OS / Distro

linux

Neovim version/commit

0.10.0

Additional context

(Sorry for the issue spam, I usually gather them and once in a while open them all together)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions