Vim incremental search

梦想的初衷 提交于 2019-11-30 00:52:10

问题


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:


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.



来源:https://stackoverflow.com/questions/25635413/vim-incremental-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!