ag.vim

Vim plugin for the CLI script 'ag'

ag.vim

This is an adaptation of Ack.vim to use Ag instead. Ag can be used as a replacement for 99% of the uses of grep. This plugin will allow you to run ag from vim, and shows the results in a split window. This plugin is almost copy and pasted from mileszs’ ack.vim plugin.

Installation

Ag

You have to install ag, of course.

Install with Homebrew:

brew install the_silver_searcher

Otherwise, you are on your own.

The Plugin

If you have Rake installed, you can just run: rake install.

Otherwise, the file ag.vim goes in ~/.vim/plugin, and the ag.txt file belongs in ~/.vim/doc. Be sure to run

:helptags ~/.vim/doc

afterwards.

Usage

:Ag [options] {pattern} [{directory}]

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 :Ag, :AgAdd, :LAg, and :LAgAdd respectively. (See doc/ag.txt, or install and :h Ag for more information.)

Keyboard Shortcuts

In the quickfix window, you can use:

o    to open (same as enter)
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
v    to open in vertical split
gv   to open in vertical split silently
q    to close the quickfix window

This plugin is almost copy and pasted from mileszs’ ack.vim plugin.

Related Repositories

ag.vim

ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack' ...

ag

ag

vim plugin to search using the silver searcher (ag) ...

nerdtree-ag

nerdtree-ag

NERDtree + ag.vim ...

ag.nvim

ag.nvim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'. Neovim Async supported ...

vim-quick-search

vim-quick-search

Effective and simple search for Ack or Ag ...


Top Contributors

mileszs epmatsw tpope malkomalko blueyed carlosgaldino troydm c9s unceus technicalpickles jdonaldson Soares airblade bitboxer ciupicri nugend gnap axelson pope rstacruz robert-chiniquy simono tarrant Walnuts blandinw