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

ack

On Linux, you can use Vim in conjunction with ack to search through code bases. ack is the spiritual successor of grep, and is focused on working with code. Install it using your favorite package manager; here's an example of using apt-get:

$ sudo apt-get install ack-grep

Visit https://beyondgrep.com/install to learn more about ack and for installation instructions.

For example, you can now use ack from the command line to search for all Python files recursively (starting in the current directory) containing the word Animal:

$ ack --python Animal

The preceding code will produce output similar to grep:

Vim has a plugin that integrates the result of ack in Vim's quickfix window (see the Quickfix List section in Chapter 5, Build, Test, and Execute, to learn more about quickfix). The plugin is available from https://github.com/mileszs/ack.vim. After installation, you will be able to execute :Ack from Vim:

:Ack --python Animal

This will run ack and populate the quickfix window (see the preceding section, as well as Quickfix List in Chapter 5Build, Test, and Execute, for more information about a quickfix window) with the output:

主站蜘蛛池模板: 缙云县| 乌鲁木齐县| 黄陵县| 罗甸县| 辰溪县| 自治县| 银川市| 隆德县| 鄂托克前旗| 纳雍县| 武邑县| 宝坻区| 徐水县| 嫩江县| 安宁市| 茂名市| 汉中市| 泸州市| 通化县| 通州区| 武陟县| 井冈山市| 西吉县| 屏山县| 克东县| 永清县| 四会市| 陆良县| 蒙自县| 高阳县| 清流县| 治县。| 化德县| 泽州县| 晋中市| 平定县| 南汇区| 凤台县| 邓州市| 土默特右旗| 剑阁县|