nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3k stars 131 forks source link

doesn't recognize the new heading with a indent #72

Open ashincoder opened 3 years ago

ashincoder commented 3 years ago

Describe the bug

In emacs after a main heading there is an indent. Even within the indent the a sub heading can be made. But in orgmode.nvim it can't. U will understand with the video rec below.

Steps to reproduce

  1. Open an org file
  2. Start a new heading with '8'
  3. Enter and get into a new line
  4. Start making a new sub heading within the indent
  5. It won't transalate into a bullet

Expected behavior

It should move into a bullet or subheading no matter where the indent.

Emacs functionality

It can move into a bullet no matter what

Screenshots and recordings

https://user-images.githubusercontent.com/83629316/131207392-20e22f32-ab65-4793-8b52-b26fdc33ed02.mp4

OS / Distro

ArchLinux

Neovim version/commit

NVIM 0.5.0

Additional context

No response

kristijanhusak commented 3 years ago

How does emacs behave for you when you do not use the org-bullets plugin? I'm just trying to figure out if there is an emacs specific setting for this, or it is part of the org-bullets plugin.

This is how it works for me in emacs without the org-bullets plugin:

bullets-indent

ashincoder commented 3 years ago

The org-bullets work if the builtin orgmode identifies it as a bullet. The only thing org-bullets does is if orgmode realises it as a sub heading then org-bullets converts it into a nice bullets

ashincoder commented 3 years ago

https://github.com/akinsho/org-bullets.nvim/issues/2

kristijanhusak commented 3 years ago

@ashincoder Here's the vimL chunk to make this work for now:

Add this to your after/indent/org.vim:

function! CustomOrgIndent() abort
  let line = getline(v:lnum)
  if match(line, '^\s\+\*\+\s*$') > -1
    return 0
  endif
  return OrgmodeIndentExpr()
endfunction

setlocal indentkeys+=<*>
setlocal indentexpr=CustomOrgIndent()
aareman commented 2 years ago

org indentation bug here is a bug I think related to this. Two issues, may be the same problem. (I have the viml chunk as well). The two issues are

  1. when starting a new heading each * I add switches it from header indent to text indent (even is text indent, maybe tree sitter is treating is as "bold text" or something.
  2. when I have an "even starred" heading with no text following it, pressing == in normal mode toggles it to be a header or text indentation
kristijanhusak commented 2 years ago

@aareman code chunk from my last comment might be outdated. I did some updates to indentation in the meantime. Generally this issue is for the "no indent" or "virtual indent" mode, where code above was just a hackish way to achieve something similar.

kristijanhusak commented 4 months ago

Even though it's still experimental, this can be achieved with virtual indentation https://github.com/nvim-orgmode/orgmode/blob/master/DOCS.md#org_startup_indented