Vim增量搜索 [英] Vim incremental search
问题描述
我在Linux机器上使用腻子.我在vi中进行搜索的常用方法是输入斜线/,然后输入搜索字符串,输入,然后按 n 或 shift + n .
I'm using putty on a Linux machine. My usual method for searching in vi is entering the slash /, then my search string, enter, then go through all the matches by n or shift + n.
我想知道vi是否具有类似Eclipse的增量搜索( ctrl + j )之类的功能,其中当我键入时,它会跳转到下一个逻辑匹配.我认为我的一位办公室同事曾经这样做,但我不确定.
I was wondering if vi had a feature like Eclipse's Incremental Search (ctrl + j), wherein as I type, it jumps to the next logical match. I think one of my office mates used to do it but I'm not sure.
推荐答案
如果您使用的是vim
(并且现在不是),则可以使用以下方法启用增量搜索:
If you're using vim
(and who isn't nowadays), you can enable incremental search with:
:set incsearch
然后只需使用常规搜索命令/
,当您向搜索字符串中添加字符时,它将移动突出显示内容.
Then just use the regular search command /
and it will move the highlight as you add characters to the search string.
我也喜欢hlsearch
,因为它会突出显示所有找到的项目(一旦执行搜索命令),以便于查看.
I also like hlsearch
as well since it highlights all found items (once the search command is done) for easy viewing.
这篇关于Vim增量搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!