nvim-orgmode / nvim-orgmode/orgmode

Indentation increases with each item

Open
#472 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

I'm having a hard time determining if this is intended or not...but it's really annoying and I'm not sure how to disable it, or if I'm just doing something wrong. The problem is that when I'm writing a list, instead of being on the same indentation level, it adds one on the new line. This is super confusing, and it also happens when org_indent_mode is set to noindent.

Steps to reproduce

When I start a list like so (| = cursor):

- List Item|

Then I press enter, I would expect this:

- List Item
|

But instead I get this:

 - List Item
   |

This means that repeatedly adding items gets each one indented an additional level, which is not what I want. If I want another level, I'll add one myself...

Expected behavior

Explained above.

Emacs functionality

Not really sure...I'm not an emacs user, and I'm not in a position to install it and check at the moment, but what demo videos I can find online do not seem to function the way this plugin does...though I think they're doing something more clever that I'm not sure is possible with neovim at all at the moment (with virtual indents and whatnot).

Minimal init.lua

The template works: https://github.com/nvim-orgmode/orgmode/blob/master/scripts/minimal_init.lua

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])

local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins()
  require('packer').startup({
    {
      'wbthomason/packer.nvim',
      { 'nvim-treesitter/nvim-treesitter' },
      { 'kristijanhusak/orgmode.nvim', branch = 'master' },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
    },
  })
end

_G.load_config = function()
  require('orgmode').setup_ts_grammar()
  require('nvim-treesitter.configs').setup({
    highlight = {
      enable = true,
      additional_vim_regex_highlighting = { 'org' },
    },
  })

  vim.cmd([[packadd nvim-treesitter]])
  vim.cmd([[runtime plugin/nvim-treesitter.lua]])
  vim.cmd([[TSUpdateSync org]])

  -- Close packer after install
  if vim.bo.filetype == 'packer' then
    vim.api.nvim_win_close(0, true)
  end

  require('orgmode').setup()

  -- Reload current file if it's org file to reload tree-sitter
  if vim.bo.filetype == 'org' then
    vim.cmd([[edit!]])
  end
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path })
  load_plugins()
  require('packer').sync()
  vim.cmd([[autocmd User PackerCompileDone ++once lua load_config()]])
else
  load_plugins()
  load_config()
end
Screenshots and recordings

No response

OS / Distro

Debian 11

Neovim version/commit

0.8.1

Additional context

No response

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

Use the provided minimal init.lua with Neovim 0.8.1 and reproduce pressing Enter after an Org list item, including with org_indent_mode set to noindent. Trace the list and newline indentation behavior; done means repeatedly creating sibling items keeps them at the same indentation level rather than increasing it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.