orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

Insert mode <CR> always over-indents when #+TITLE is missing

Open rsynnest opened this issue 10 months ago • 1 comments

Describe the bug

I tested this with a minimal config with only orgmode and nvim-treesitter. In an orgmode file without #+TITLE as the first line, hitting <CR> in insert mode indents when it should not.

If I type out the following entirely in insert mode, with zero manual indentation, each indents more than it should (especially annoying for hyphen bulleted lists where each new item indents deeper):

* head
   ** a
   - b 
     - c
       - d

The output I expect:

* head
** a
   - b 
   - c
   - d

If I comment out these 3 lines the bug dissapears: https://github.com/nvim-orgmode/orgmode/blob/3629625199b9a45bdb41fa734bc2c6ef86d251bd/lua/orgmode/org/indent.lua#L76-L78`

checkhealth

============================================================================== orgmode: ✅

Orgmode ~

  • ✅ OK Treesitter grammar installed (version 2.0.2)
  • ✅ OK Setup called
  • ✅ OK org_agenda_files configured
  • ✅ OK org_default_notes_file configured

Steps to reproduce

  1. Open test.org
  2. Type out the following outline without any manual indentations, entirely in insert mode: Expected:
* head
** a
   - b 
   - c
   - d

Actual:

* head
   ** a
   - b 
     - c
       - d

Expected behavior

Indentation should behave the same whether #+TITLE exists or not

Emacs functionality

No response

Minimal init.lua


-- minimal_init.lua
-- Ensure you use the correct syntax for your plugin manager (e.g., Packer, lazy.nvim, etc.)

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

if not vim.uv.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--branch=stable",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end

vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  -- Specify only the plugins you need for troubleshooting:
  "nvim-treesitter/nvim-treesitter",
  -- Add other specific plugins here
  {
    'nvim-orgmode/orgmode',
    event = 'VeryLazy',
    ft = { 'org' },
    config = function()
      -- Setup orgmode
      require('orgmode').setup({
        org_agenda_files = '~/orgfiles/**/*',
        org_default_notes_file = '~/orgfiles/refile.org',
      })
    end,
  },
})


Screenshots and recordings

https://asciinema.org/a/Bxa13dKwP3pIN7cIcbx9RyHp8

nvim-orgmode version

3629625199b9a45bdb41fa73

OS / Distro

MacOS 26.1

Neovim version/commit

v0.11.2

Additional context

No response

rsynnest avatar Jan 06 '26 07:01 rsynnest

I also am experiencing this as well. I am using roam and creating a list here and when i hit enter or even nvim (o) it will auto indent. I dropped a picture of what I am experiencing as well.

Image

aaronshahriari avatar Jan 31 '26 10:01 aaronshahriari