在Emacs组织模式中折叠当前轮廓

Ame*_*ina 14 emacs org-mode

假设我在具有以下结构的文档中处于org-mode:

* First headline 
* Second headline
** Section A
   Here is one line
   Here is another line
   blah, blah
** Section B
Run Code Online (Sandbox Code Playgroud)

假设光标位于读取的行上Here is another line.我想** Section A用键盘快捷键从这个位置折叠.

  • 如果我按下<TAB>它不会崩溃** Section A,因为我需要光标在星星上才能工作.
  • 如果我按下<Shift-TAB>它会折叠所有轮廓,而不是当前轮廓.

有什么办法来循环通过轮廓的塌陷范围(即"当前纲要")?

cyo*_*yon 16

您可以通过更改值来自定义org-cycle命令(绑定到<TAB>)的行为org-cycle-emulate-tab.

** Section A在光标打开时将其折叠,Here is another line请将以下行添加到.emacs文件中:

(setq org-cycle-emulate-tab 'white)
Run Code Online (Sandbox Code Playgroud)

white将允许您仍然使用<TAB>缩进空行.来自emacs文档:

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
Run Code Online (Sandbox Code Playgroud)