[英]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.