将区域变成列表
在组织模式下,我想将一个区域放入列表中。
假设我有以下文本
One
Two
Three
如何将其变成以下列表(除非手动编辑它)?
- One
- Two
- Three
在标记区域后,我可以运行一些命令来实现此目的吗?
In Org-mode I want to a region into a list.
Say that I have the following text
One
Two
Three
How can I turn it into the following list (except by manually editing it)?
- One
- Two
- Three
Is there some command I can run to achieve that after I have marked the region?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有很多方法。以下是一些:
query-replace-regexp
:要么标记区域,要么将点移动到第 1 行的开头,然后使用 CM-% <代码>^ RET-
RET。如果您标记了该区域,则可以使用 ! 替换该区域中的所有匹配项。string-rectangle
:将标记设置在第1行的开头,将点移动到第3行的开头,输入Cxr t-
RET< code>cua-selection-mode:如果启用 cua-selection-mode(我在 .emacs 中打开此功能),您可以在第 1 行开头激活一个矩形C-RET,将点向下移动到第 3 行的开头,键入
-
,然后再次键入 C-RET 以停用矩形。键盘宏:在第 1 行,键入 F3 或 Cx( 开始录制,然后键入 -< kbd>SPC 作为宏的内容,F4 或Cx) 停止录制。现在,您可以标记该区域并键入 CxCkr 将该宏应用到该区域中的每一行。
(编辑)我不知何故错过了这是关于组织模式的,这使得它与 emacs:Orgmode,如何从行块中创建列表(请参阅gregor 的回答)。
There are lots of ways. Here are a few:
query-replace-regexp
: Either mark the region, or just move point to the beginning of line 1, then use C-M-%^
RET-
RET. If you marked the region, you could use ! to replace all matches in the region.string-rectangle
: Set the mark at the beginning of line 1, move point to the beginning of line 3, type C-xrt-
RETcua-selection-mode
: If you enable cua-selection-mode (I turn this on in my .emacs), you can activate a rectangle at the beginning of line 1 with C-RET, move point down to the beginning of line 3, type-
, and then type C-RET again to deactivate the rectangle.Keyboard macros: On line 1, type F3 or C-x( to start recording, then -SPC as the content of the macro, and F4 or C-x) to stop recording. Now you can mark the region and type C-xC-kr to apply that macro to each line in the region.
(edit) I somehow missed that this was about org-mode, which makes this a duplicate of emacs: Orgmode, how to make a list from a block of lines (see gregor's answer).