如何用Emacs中的换行符替换一个字符? [英] How to replace a character with a newline in Emacs?
问题描述
我正在使用替换字符串
替换一个字符 - 例如;
或在Emacs中替换regexp
我尝试过以下命令:
-
Mx
replace-string
RET code>; RET\\\
这将用2个字符替换
;
\\\
。
-
Mx
replace-regex
RET;
RET\\\
这会导致以下错误显示在minibuffer中):
替换文本中使用\无效。
使用 replace-string
为此任务?还有其他方式吗?
谢谢。
Mx replace-string
kbd> RET ;
RET Cq Cj 。
-
Cq for
quoted-insert
, -
Cj 是一个换行符。
干杯! / p>
I am trying to replace a character - say ;
- with a new line using replace-string
and/or replace-regexp
in Emacs.
I have tried the following commands:
M-x
replace-string
RET;
RET\n
This will replace
;
with 2 characters:\n
.M-x
replace-regex
RET;
RET\n
This results in the following error (shown in the minibuffer):
Invalid use of `\' in replacement text.
What's wrong with using replace-string
for this task? Is there any other way to do it?
Thanks.
M-x replace-string
RET ;
RET C-q C-j.
C-q for
quoted-insert
,C-j is a newline.
Cheers!
这篇关于如何用Emacs中的换行符替换一个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!