Vim incremental search

2019-02-11 11:59发布

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.

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.

1条回答
我只想做你的唯一
2楼-- · 2019-02-11 12:31

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.

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

查看更多
登录 后发表回答