nvim-orgmode / nvim-orgmode/orgmode

Improve `org_meta_return` coherence on lists

Open
#858 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
3.9k
Forks
190
Avg merge
2d 13h
Merged PRs (30d)
7

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the org_meta_return and org_insert_heading_respect_content entry points, then reproduce the list and checklist examples from the issue using the provided minimal init.lua. Compare their behavior around nested list content; done means org_meta_return leaves the nested subline with the original item while creating the new sibling item as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.