eclipse Vim 增量搜索

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25635413/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:56:40  来源:igfitidea点击:

Vim incremental search

linuxeclipsevimputty

提问by Michael Sanchez

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 nor shift+ n.

我在 Linux 机器上使用腻子。我在 vi 中搜索的常用方法是输入斜杠/,然后输入我的搜索字符串,输入,然后通过nshift+遍历所有匹配项n

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.

我想知道 vi 是否有像 Eclipse 的增量搜索 ( ctrl+ j) 这样的功能,当我输入时,它会跳转到下一个逻辑匹配。我想我的一位同事曾经这样做过,但我不确定。

回答by paxdiablo

If you're using vim(and who isn't nowadays), you can enable incremental search with:

如果您正在使用vim(现在谁还没有使用),您可以通过以下方式启用增量搜索:

:set incsearch

Then just use the regular search command /and it will move the highlight as you add characters to the search string.

然后只需使用常规搜索命令/,它会在您向搜索字符串添加字符时移动突出显示。

I also like hlsearchas well since it highlights all found items (once the search command is done) for easy viewing.

我也喜欢hlsearch它,因为它突出显示了所有找到的项目(搜索命令完成后)以便于查看。