Original title: How to display sub-heading count in the end of a heading in org-mode
It would be very helpful if such a feature can be acheived. I always have difficulty when visiting a long-time not visited org file, where it may have lots of headings and their sub-headings, and so on.
I need to have an overall grasp of which headings have sub-headings when they are collapsed. Since, headings and sub-headings are a lot, so I'm used to only showing first-level headings and opening up a certain heading when I know exactly that it has sub-headings. If I use C-Tab, all second-level sub-headings of first-headings will be shown up, which adds more obstacle for navigating!
In ideal, sub-headings of their parent heading should also have a sub-heading count in the end of them.
I saw this post Counting sub-headings in org-mode using elisp in emacs.stackchange.com, where the adopted answer implemented a function to print the total count of all the sub-headings of a heading are, where the cursor is at.
For example:
* First-level heading that has sub-headings [5]...
** Sub-heading1 that has its own sub-headings [3]...
*** Heading1 [0]...
Just some text
*** Heading2 [1]...
Some text
**** Heading1 [0]...
Just some text
** Sub-heading 2 [0]...
Just some text
It would be more intuitive, only to show count of sub-headings, but not recursively, as follows:
* First-level heading that has sub-headings [2]...
** Sub-heading1 that has its own sub-headings [2]...
*** Heading1 [0]...
Just some text
*** Heading2 [1]...
Some text
**** Heading1 [0]...
Just some text
** Sub-heading 2 [0]...
Just some text
Note: The behavior of ellipsis should be the default, the example above where the ellipsis is displayed when headings are expanded, is for better demonstration.
Is it possible to add it to each heading indicating how many sub-headings a heading has?