ag.vim


Ⅰ. 插件描述

Vim plugin to search recursively using ag or ack if they are installed.

Ⅱ. 基本信息

创建日期:  2014-04-09
使用用户:  9
Github星:  1
插件作者:  Scott Blevins

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'smeggingsmegger/ag-vim-fearless'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'smeggingsmegger/ag-vim-fearless'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'smeggingsmegger/ag-vim-fearless'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/smeggingsmegger/ag.vim

Ⅳ. 文档说明

# ack.vim

This plugin is a front for the utility Ag or the Perl module App::Ack. Ag/Ack can be used as a replacement for 99% of the uses of _grep_. This plugin will allow you to run ag / ack from vim, and shows the results in a split window.

Installation

Ack

You will need ag / ack, of course, to install it follow the
manual

The Plugin

To install it is recommended to use one of the popular package managers for Vim,
rather than installing by drag and drop all required files into your .vim folder.

Manual (not recommended)

Just
download the
plugin and put it in your ~/.vim/(or %PROGRAMFILES%/Vim/vimfiles on windows)

Vundle

Bundle 'smeggingsmegger/ag.vim'

NeoBundle

NeoBundle 'smeggingsmegger/ag.vim'

Usage

:Ack [options] {pattern} [{directories}]

Search recursively in {directory} (which defaults to the current directory) for
the {pattern}.

Files containing the search term will be listed in the split window, along with
the line number of the occurrence, once for each occurrence. [Enter] on a line
in this window will open the file, and place the cursor on the matching line.

Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use
:Ack, :AckAdd, :LAck, and :LAckAdd respectively.
(See doc/ack.txt, or install and :h Ack for more information.)

For more ack options see
ack documentation

Keyboard Shortcuts

In the quickfix window, you can use:

o    to open (same as enter)
O    to open and close quickfix window
go   to preview file (open but maintain focus on ag.vim results)
t    to open in new tab
T    to open in new tab silently
h    to open in horizontal split
H    to open in horizontal split silently
v    to open in vertical split
gv   to open in vertical split silently
q    to close the quickfix window

Gotchas

Some characters have special meaning, and need to be escaped your search

  1. For instance, '#'. You have to escape it like this `:Ack '\#define
    foo'` to search for '#define foo'.

添加新评论