The Simple Emacs Interface to Ack-like Tools
This package integrates ack with Emacs. The resulting *ack*
buffer
is just like vanilla *grep*
but results come from your tool of
choice.
Not only ack, but Ack-like tools such as the silver searcher (ag), ripgrep (rg) are well supported, as are
git grep
and hg grep
.
The program guesses good defaults -- including searching for the thing
at point -- but lets you input C-u
to customize the directory,
commands, switches etc...
Ack is part of GNU ELPA - the official package archive for Emacs:
M-x package-install RET ack RET
Just M-x ack
or do something like (global-set-key (kbd "C-c
C-g") 'ack)
.
- ack
- git grep
- Type
M-x ack
and provide a pattern to search. - Type
C-u M-x ack
to search from current project root. - Type
C-u C-u M-x ack
to interactively choose a directory to search.
While reading ack command and args from the minibuffer, the following key bindings may be useful:
M-I
=> insert a template for case-insensitive file name searchM-G
=> insert a template forgit grep
,hg grep
orbzr grep
M-Y
=> grab the symbol at point from the window before entering the minibufferTAB
=> completion for ack options
If you use the above keybindings very often, stick the corresponding
command names in ack-minibuffer-setup-hook
. The following snippet
makes M-x ack
insert a git|hg|bzr grep
template if searching
from a project root. Then it will try to insert the symbol at point.
(add-hook 'ack-minibuffer-setup-hook 'ack-skel-vc-grep t)
(add-hook 'ack-minibuffer-setup-hook 'ack-yank-symbol-at-point t)
Check out the emacs23 branch.
https://github.com/leoliu/ack-el/issues
Phillip Lord. The original author and previous mantainer is Leo Liu.