nvim-orgmode / nvim-orgmode/orgmode
Folding is not respected when using `org_move_subtree_up` or `org_move_subtree_down`
Open
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
When moving headlines with those bindings the foldings are not respected
Steps to reproduce
Using the next file as a base:
* heading 1
** subheading 2
** subheading 3
*** subsubheading 1
text
**** subsubsubheading1
text
- If you unfold the first level and use
org_move_subtree_upon thesubheading 3, it will move the headline but it will fold everything so that you only seeheading 1 - If you show the folds below
subheading 3(but not enough to seesubsubsubheading1) and useorg_move_subtree_down, then all folds are open:
Expected behavior
Folds are respected when moving headlines around
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",
},
})
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.4
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the org_move_subtree_up and org_move_subtree_down entry points and reproduce the behavior with the org file shown in the issue. Inspect how each binding moves headlines and preserves folding state. Done means the existing folds remain unchanged after moving subheading 3 up or down in both reported scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100