jceb / vim-orgmode

Text outlining and task management for Vim based on Emacs' Org-Mode
http://www.vim.org/scripts/script.php?script_id=3642
Other
3.12k stars 267 forks source link

Heading Tree structure broken when non-heading content inserted in between #216

Closed Ron89 closed 8 years ago

Ron89 commented 8 years ago

As a simple example, in following structure

    * Heading-1-1
    content
    ** Heading-2-1
    ** Heading-2-2
    * Heading-1-2

When using <localleader>hh on Heading-1-1, insead of inserting a heading before Heading-1-2, the new heading will be place immediately after content. This design prevents user from adding comment on the heading before moving into deeper headings. It also differs from how orgmode on emacs behaves(which is how it should have been). I believe the cause of the issue is that subtree parsing stops at the first non-heading content. Hence the followed subtree were mistreated as siblings rather than children.

Ron89 commented 8 years ago

Sorry, I remembered the command wrongly... <localleader>hn is insert new heading after children. <localleader>hh is insert new heading before children.

But still, shouldn't we put the function of <localleader>h[N/n/h] in to the document? Come to think of it, I didn't even know these keybinding until reading the code...

Ron89 commented 8 years ago

Actually, behavior of <localleader>hh is still off, since it should have create a heading before content rather than after it. I'll leave this issue open until

jceb commented 8 years ago

Hm, actually I think the behavior is okay. Creating a heading before content is something I wouldn't want to do. Heading and content belong together in my opinion .. but maybe Emacs org-mode implements things differently.

Ron89 commented 8 years ago

Technically, " insert heading, taking over all children " should include content. And yes, emacs version handle it differently. But it's your call.

Ron89 commented 8 years ago

orgguide updated.