(TIL) Org-mode 自带类似 Workflwoy 的 focus 功能

以前把玩 Workflowy 的时候,有一个功能我很喜欢,但它没具体名字,在 Workflowy 的首页上,是这么介绍的:

Zoom into your notes and focus on just one part

放大你的笔记,专注于某一部分

Clicking a bullet, zooms you into it and displays any indented items. This is how we view items as documents, by zooming into them.

点击一个项目符号,系统会将你放大到该项目符号,并显示任何缩进的内容。这就是我们如何将条目视为文档,通过放大查看它们。

If a bullet has no indented items, you’ll see an empty page with the title of the bullet you clicked on.

如果一个项目符号没有缩进的内容,你将看到一个空白页面,页面上显示你点击的项目符号的标题。

没想到 org-mode 里直接内置类似的功能了,具体命令是 ~org-narrow-to-subtree~。执行这个命令之后,再执行 ~widen~,视图就可以恢复原装。

只需要将快捷键绑定到具体的命令上就可用:

(global-set-key (kbd "C-c n") 'org-narrow-to-subtree)
(global-set-key (kbd "C-c w") 'widen)

PixPin_2025-02-20_16-58-25

原文:

2 个赞

以前有讨论过 【讨论】分享一个 Neovim 插件 Yode-nvim,不知道 Emacs 有没有实现过类似功能 - #6,来自 gadmyth

带narrow功能的还有很多函数。

比如,我习惯将所有文本笔记内容放到同一个文本文件,实际编辑的时候,选择内容,再使用narrow-to-region功能,这样就显得当前编辑界面很清爽。

另外workflowy以前是不能同时打开多个页面的,现在不知道行不行,但emacs有indirect buffer。

1 个赞

感谢,indirect buffer 用处很多,有这个根本不必装 org-sidebar 了

一个按键绑定org-toggle-narrow-to-subtree 就行了。

还可以搭配org-tree-to-indirect-buffer使用,因为到indirect-buffer之后默认是narrow-to-subtree的,可以用上面命令直接恢复。

3 个赞

org 好像默认就绑了这些:

  `org-mode' Major Mode Bindings Starting With C-x n:

Key             Binding

C-x n b			org-narrow-to-block
C-x n e			org-narrow-to-element
C-x n s			org-narrow-to-subtree

widen 默认绑定 C-x nw

1 个赞

这是很实用的功能,我很早就用上了

恭喜