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

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:

主站蜘蛛池模板: 吉木萨尔县| 桦川县| 乐平市| 大荔县| 五原县| 平和县| 夏津县| 卓资县| 隆尧县| 青海省| 宾川县| 德阳市| 朝阳区| 冀州市| 堆龙德庆县| 班玛县| 华池县| 胶南市| 广西| 志丹县| 汪清县| 广水市| 通城县| 米泉市| 巴彦淖尔市| 五华县| 白沙| 阿坝| 五大连池市| 射洪县| 普宁市| 青神县| 比如县| 筠连县| 全州县| 长葛市| 克山县| 岳阳县| 沙坪坝区| 渭源县| 花垣县|