orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

doesn't recognize the new heading with a indent

Open ashincoder opened this issue 4 years ago • 7 comments

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

ashincoder avatar Aug 28 '21 05:08 ashincoder

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

kristijanhusak avatar Aug 28 '21 18:08 kristijanhusak

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 avatar Aug 29 '21 01:08 ashincoder

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

ashincoder avatar Aug 29 '21 01:08 ashincoder

@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()

kristijanhusak avatar Aug 30 '21 14:08 kristijanhusak

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

aareman avatar Jun 24 '22 18:06 aareman

@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 avatar Jun 27 '22 19:06 kristijanhusak