如何搜索选定的文本? [英] How do I search for the selected text?
问题描述
如何搜索选定的(使用 v
和 y
)字符串?我通常用/
搜索,但是我无法在/
之后粘贴选定的字符串.
How do I search for the selected (with v
and y
) string? I usually search with /
, but I cannot paste the selected string after /
.
推荐答案
在插入模式下你可以使用 CTRL-R 插入 Vim 寄存器的内容.默认情况下,复制的文本被放置在未命名的寄存器 "
中,因此要插入该文本,您将在插入模式下键入
.搜索提示使用 命令行模式,它有自己的CTRL-R 与插入模式下的几乎相同.
In insert mode you can use CTRL-R to insert the contents of Vim registers. By default, copied text gets put in the unnamed register "
, so to insert that text you would type <C-R>"
in insert mode. The search prompt uses Command-line mode which has its own
CTRL-R that works almost identically to the one in Insert mode.
因此,如果我只是猛拉文本 foo
,输入 /
将搜索文本 foo
一旦我按回车键.
So if I just yanked the text foo
, typing /<C-R>"
would search for the text foo
once I press enter.
这篇关于如何搜索选定的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!