在 Vim 中以可视模式选择一个单词后,如何搜索它? [英] How can I search a word after selecting it in visual mode in Vim?
本文介绍了在 Vim 中以可视模式选择一个单词后,如何搜索它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在视觉模式下选择了一个词.现在我想在文档中搜索那个词.
Suppose I have selected a word in visual mode. Now I want to search that word in the document.
我该怎么做?
提前致谢.
推荐答案
按 y(之后您将退出可视模式)然后按/Ctrl+r 然后结束回车.
Press y (you'll exit from visual mode after that) then press / Ctrl+r then " end hit enter.
您可以使用它来绑定//用于此操作:
You can use it to bind // for this action:
:vmap // y/<C-R>"<CR>
如果您选择特殊字符,最好使用它
If you select special chars you better use this
:vmap <silent> // y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR>
这篇关于在 Vim 中以可视模式选择一个单词后,如何搜索它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文