繁体   English   中英

编辑emacs query-replace中的上一个搜索字符串?

[英]Edit the previous search string in emacs query-replace?

在emacs中使用query-replace(有或没有regexp)时,会记住先前的查询替换对,并在下次调用query-replace时将其建议为默认值。 但我希望能够将此默认替换编辑为类似的东西,而无需键入整个新变体。

像这样:

在一个长文档的一部分中,我做了一个查询替换

M-% antidisestablishmentarianism-A [return] antidisestablismentarianism-B

后来在我想做的同一份文件中

M-% antidisestablishmentarianism-A [return] antidisestablismentarianism-C

命令M-%本身给出

Query-replace (default antidisestablishmentarianism-A -> antidisestablismentarianism-B):

是否有一些魔术键组合可以将最终的“B”更改为“C”而无需重新输入?

是的,试试Mp ,就像这个序列

M-% M-p [return] M-p [DEL] C [return]

我也可以用Cr。 它显示了迷你缓冲区中的所有条目,我可以从中进行选择。 我有Cr绑定到Mx任何 - 迷你缓冲区历史。 在Mx查询替换之后,按Ch b并在帮助缓冲区中搜索主模式。 这将给出完整的命令列表。 这是我的绑定。

C-g     abort-recursive-edit
TAB     self-insert-command
C-j     exit-minibuffer
RET     exit-minibuffer
C-r     anything-minibuffer-history
ESC     Prefix Command
C-tab       file-cache-minibuffer-complete
down        next-history-element
next        next-history-element
prior       previous-history-element
up      previous-history-element
M-n     next-history-element
M-p     previous-history-element
M-r     previous-matching-history-element
M-s     next-matching-history-element

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM