Say I am in org-mode in a document with the following structure:
* First headline
* Second headline
** Section A
Here is one line
Here is another line
blah, blah
** Section B
Say the cursor is on the line that reads Here is another line
. I would like to collapse ** Section A
from this location with a keyboard shortcut.
<TAB>
it does not collapse ** Section A
, as I would need the cursor to be on the stars for this to work.<Shift-TAB>
it collapses all outlines, and not the current one.Is there any way to cycle through the collapsing of the outline in scope (i.e. the "current outline")?
You can customize the behaviour of the org-cycle
command (which is bound to <TAB>
) by changing the value of org-cycle-emulate-tab
.
To get it to collapse ** Section A
when your cursor is on Here is another line
add the following line to your .emacs file:
(setq org-cycle-emulate-tab 'white)
The white
will allow you to still use <TAB>
to indent in empty lines. From org-mode Github:
org-cycle-emulate-tab's value is t
Documentation:
Where should `org-cycle' emulate TAB.
nil Never
white Only in completely white lines
whitestart Only at the beginning of lines, before the first non-white char
t Everywhere except in headlines
exc-hl-bol Everywhere except at the start of a headline