How can I override the org-mode indentation function of
evil-insert-state-map? I'd like it to always fold and unfold the current or parent header, and switch the indentation functionality to another keybinding.
From the doc of
When point is not at the beginning of a headline, execute the global binding for `TAB', which is re-indenting the line. See the option `org-cycle-emulate-tab' for details.
nil will do.
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 If TAB is used in a place where it does not emulate TAB, the current subtree visibility is cycled.
Note how when everything fails, fallback to cycle the headings (Last 4 lines).
(cond ...... ((or (eq org-cycle-emulate-tab t) (and (memq org-cycle-emulate-tab '(white whitestart)) (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) (or (and (eq org-cycle-emulate-tab 'white) (= (match-end 0) (point-at-eol))) (and (eq org-cycle-emulate-tab 'whitestart) (>= (match-end 0) pos))))) (call-interactively (global-key-binding (kbd "TAB")))) (t (save-excursion (org-back-to-heading) (org-cycle))))