当search & replace在Vim中进行更复杂的操作时,我经常尝试一下,search并且只有在找到我期望使用的内容时才会尝试search & replace.
有没有办法如何访问最后一个值search并将其放入search & replace或替代,将最后一个值放入register?
从VIM 维基页面:
:%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.
Run Code Online (Sandbox Code Playgroud)