官术网_书友最值得收藏!

Searching with / and ?

Most times one of the fastest ways to navigate somewhere is to search for a particular string. Vim allows you to search for a match by typing in / (which puts you in command-line mode) followed by a search string. Once you hit Enter, your cursor will move to the first match.

Cycling through the matches in the same buffer can be done by pressing n to go to the next match and N to the previous match.

A useful option for searching is set hlsearch (consider setting it in your .vimrc file), since it highlights every match on the screen. For example, this is how running /kind in animal_farm.py looks with hlsearch enabled:

You can clear the highlights by executing :noh.

Another nifty trick is using set incsearch . This will make Vim dynamically  move you to the first match as soon as you type.

In case you want to search backwards, replace / with ?. This will also affect the way n and N will behave, showing a next backward match, and a previous backward match respectively.

主站蜘蛛池模板: 黄平县| 彭泽县| 离岛区| 垫江县| 兴宁市| 白朗县| 湛江市| 泗阳县| 张家口市| 五台县| 古浪县| 全南县| 咸阳市| 洪泽县| 宜兴市| 郎溪县| 巴青县| 武汉市| 温州市| 永福县| 龙游县| 高陵县| 班戈县| 迁安市| 盐城市| 玛沁县| 光山县| 南昌县| 南宁市| 九寨沟县| 勃利县| 会泽县| 玉树县| 轮台县| 井研县| 中牟县| 云安县| 北安市| 客服| 江阴市| 荃湾区|