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

dev*_*ull 6 vim

search & replace在Vim中进行更复杂的操作时,我经常尝试一下,search并且只有在找到我期望使用的内容时才会尝试search & replace.

有没有办法如何访问最后一个值search并将其放入search & replace或替代,将最后一个值放入register

Luk*_*son 5

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)