don't know if there is a direct way, haven't heard of it yet at least. But one approach would be to use string-rectangle (C-x r t) to prepand 1. to all lines and then hit C-c C-c to update the numbering.
For string-rectangle you would put point and mark the following way:
v---mark
line1 with some text
line2 with more text
<---point
After M-x: string-rectangle: 1. you will get:
1. line1 with some text
1. line2 with more text
Hitting C-c C-c will give you the correct numbering!
Easier because it gives you visual feedback is to enable CUA-mode and use C-return to create a rectangle selection, then you can start typing on all lines in parallel. See also this video on youtube.
** 新命令“Cx r N”(“矩形编号行”)对当前矩形中的行进行编号。使用前缀参数,这会提示输入 格式字符串的计数编号。
现在,您可以轻松地对行或列表进行编号,而无需使用宏或其他 elisp 函数。标记文本的垂直区域(使用瞬态标记模式可能会有所帮助),1 个字符宽,然后按 Cx r N 即可。 Emacs 对行进行编号。
如果您使用前缀命令 Cu(例如 Cu Cx r N),它将提示您输入起始数字和格式字符串,因此您可以从任意数字开始并指定句点或括号或前面或后面的任何内容号码。
Found this on emacsworld.blogspot.com (I made some minor edits):
In Emacs 24.1, the NEWS file had this new addition to the rectangle commands.
** New command `C-x r N' (`rectangle-number-lines') numbers the lines in the current rectangle. With a prefix argument, this prompts for a number to count from and for a format string.
This allows you to now number lines or lists easily without using a macro or additional elisp functions. Mark a vertical region of text (using transient mark mode may help), 1 character wide, and then hit C-x r N and that's it. Emacs numbers the lines.
If you use the prefix command C-u (for example, C-u C-x r N), it will prompt you for a starting digit and the format string, so you can start at an arbitrary number and specify a period or paren or whatever to precede or follow the number.
发布评论
评论(4)
我知道的最短的方法是:突出显示这些行,包括它们的换行符,
然后执行
Mx org-ctrl-c-minus
(按Cc -
),你会得到然后运行
Mx org-shiftright
(按
)两次,您将获得所需的结果the shortest way I know of is: highlight the lines, including their newline character,
Then execute
M-x org-ctrl-c-minus
(pressC-c -
) and you will getThen run
M-x org-shiftright
(press<S-right>
) twice and you get the desired不知道有没有直接的方法,至少还没听说过。但一种方法是使用
string-rectangle
(Cx r t
) 将1.
预置到所有行,然后点击Cc Cc
更新编号。对于
string-rectangle
,您可以按照以下方式放置点和标记:在
Mx: string-rectangle: 1.
之后,您将得到:点击
Cc Cc
将为您提供正确的编号!启用
CUA-mode
和使用C-return
创建一个矩形选择,然后您可以开始在所有行上并行输入。另请参阅 YouTube 上的此视频。don't know if there is a direct way, haven't heard of it yet at least. But one approach would be to use
string-rectangle
(C-x r t
) to prepand1.
to all lines and then hitC-c C-c
to update the numbering.For
string-rectangle
you would put point and mark the following way:After
M-x: string-rectangle: 1.
you will get:Hitting
C-c C-c
will give you the correct numbering!Easier because it gives you visual feedback is to enable
CUA-mode
and useC-return
to create a rectangle selection, then you can start typing on all lines in parallel. See also this video on youtube.另请参阅
org-toggle-item
以转换为纯文本列表或编号列表。See also
org-toggle-item
to convert to plain-text list or numbered list.在 emacsworld.blogspot.com 上找到了这个(我做了一些小的编辑):
在 Emacs 24.1 中,NEWS 文件在矩形命令中添加了这个新内容。
现在,您可以轻松地对行或列表进行编号,而无需使用宏或其他 elisp 函数。标记文本的垂直区域(使用瞬态标记模式可能会有所帮助),1 个字符宽,然后按 Cx r N 即可。 Emacs 对行进行编号。
如果您使用前缀命令 Cu(例如 Cu Cx r N),它将提示您输入起始数字和格式字符串,因此您可以从任意数字开始并指定句点或括号或前面或后面的任何内容号码。
Found this on emacsworld.blogspot.com (I made some minor edits):
In Emacs 24.1, the NEWS file had this new addition to the rectangle commands.
This allows you to now number lines or lists easily without using a macro or additional elisp functions. Mark a vertical region of text (using transient mark mode may help), 1 character wide, and then hit C-x r N and that's it. Emacs numbers the lines.
If you use the prefix command C-u (for example, C-u C-x r N), it will prompt you for a starting digit and the format string, so you can start at an arbitrary number and specify a period or paren or whatever to precede or follow the number.