gpt4 book ai didi

vim - 如何访问 Vim 中搜索中使用的最后一个表达式?

转载 作者:行者123 更新时间:2023-12-04 15:11:06 26 4
gpt4 key购买 nike

做更复杂的时候search & replace在 Vim 中的操作我经常在 search 中尝试并且仅当它找到我期望的内容时,我才会使用 search & replace .

有没有办法从 search 访问最后一个值并将其放入 search & replace或者,将最后一个值放入 register ?

最佳答案

来自 VIM wiki page :

:%s//<c-r>//g
Replace each match of the last search pattern with the / register (the last search pattern).
After pressing Ctrl-R then / to insert the last search pattern (and before pressing Enter to perform the command), you could edit the text to make any required change.

关于vim - 如何访问 Vim 中搜索中使用的最后一个表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24342181/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com