Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,079 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
lua
Domain
tooling

Research direction

Start with lua/org/indent.lua at the three linked lines around L76-L78, then reproduce the issue using the minimal init.lua and an org file without a #+TITLE line. Compare insert-mode indentation for the supplied outline; done means the output matches the expected indentation and behaves the same when #+TITLE is present or absent.

Written by the indexing model from the issue text.

Description

bug
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

Dominant language
Lua
Stars
3.9k
Forks
192
Avg merge
1d 10h
Merged PRs (30d)
11

Getting set up

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.

More from nvim-orgmode/orgmode

All issues in nvim-orgmode/orgmode

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.