• Stars
    star
    492
  • Rank 89,476 (Top 2 %)
  • Language
    Emacs Lisp
  • Created over 11 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The silver searcher with helm interface

melpa badge melpa stable badge

helm-ag.el

CI Build Status

Introduction

helm-ag.el provides interfaces of The Silver Searcher with helm.

Features

Screenshot

helm-ag

Requirements

Installation

helm-ag is available on MELPA and MELPA stable

You can install helm-ag with the following command.

M-x package-install [RET] helm-ag [RET]

Basic Usage

helm-ag

Input search word with ag command. You can change search directory with C-u prefix.

helm-ag-this-file

Same as helm-ag except to search only current file

helm-do-ag

Search with ag like helm-do-grep-ag , helm-grep-do-git-grep. You can specify extra command line option of ag with minus prefix(M-- or C--).

Screen cast of helm-do-ag

helm-do-ag-this-file

Same as helm-do-ag except to search only current file

helm-do-ag-this-file-or-occur

Smartly switch between helm-do-ag-this-file and helm-occur based on helm-ag-large-file-threshold.

helm-ag-project-root

Call helm-ag at project root. helm-ag seems directory as project root where there is .git or .hg or .svn.

helm-do-ag-project-root

Call helm-do-ag at project root.

helm-ag-buffers

Search buffers by helm-ag

helm-do-ag-buffers

Search buffers by helm-do-ag

helm-ag-pop-stack

Move to point before jump

helm-ag-clear-stack

Clear context stack

Enable helm-follow-mode by default

Please set helm-follow-mode-persistent to non-nil if you want to use helm-follow-mode by default. You must set it before loading helm-ag.el.

(custom-set-variables
 '(helm-follow-mode-persistent t))

Persistent action

You can see file content temporarily by persistent action(C-j).

Search Tips of helm-ag

Passing command line options and pattern
Pattern: -Gmd$ search_pattern

Command line options is -Gmd$ and search pattern is search_pattern. helm-ag treats words which starts with - as command line option.

Pattern contains space(helm-do-ag)
Pattern: foo\ bar\ baz

Search pattern is foo\ bar\ baz. You need to escape spaces with backslash.

In helm-ag, you need not to escape spaces.

Pattern starts with -
Pattern: -- --count

Search pattern is --count. helm-ag treats words after -- as search pattern.

Search meta characters as literal

ag(ack, pt) takes Perl compatible PCRE so that you need to escape meta characters likes brackets, braces, asterisk, when you search them as literals.

Use short option

Don't use space between option and its value. For example -tcpp is ok, -t cpp is not ok.

Use long option

Please always use = separator for using long option. Don't use space as separator. For example --ignore=pattern is ok, --ignore pattern is not ok.

Customize

helm-ag-base-command(Default: ag --nocolor --nogroup)

Base command of ag. Windows users should set --vimgrep option for using helm-do-ag. See #293

helm-ag-command-option(Default: nil)

Command line option of base command.

helm-ag-insert-at-point(Default: nil)

Insert thing at point as default search pattern, if this value is non nil. You can set the parameter same as thing-at-point(Such as 'word, symbol etc).

helm-ag-fuzzy-match(Default: nil)

Enable fuzzy matching.

helm-ag-use-grep-ignore-list(Default: nil)

Use grep-find-ignored-files and grep-find-ignored-directories as ignore pattern. They are specified to `--ignore' options."

helm-ag-always-set-extra-option(Default: nil)

Always set extra command line option of ag in helm-do-ag if this value is non-nil.

helm-ag-edit-save(Default: t)

Save buffers you edit at editing completed.

helm-ag-use-emacs-lisp-regexp(Default: nil)

Use Emacs Lisp regexp instead of PCRE as pattern. NOTE: this is very simple conversion.

helm-ag-use-agignore(Default: nil)

Use .agignore file at project root if this variable is non nil.

helm-ag-use-temp-buffer(Default: nil)

Use temporary buffer and not open file for persistent action.

helm-ag-ignore-buffer-patterns(Default: nil)

Ignore buffer patterns of buffer search commands.

NOTE

helm removes file-line type feature from 1.6.9. So helm-ag-source-type is no longer available.

Keymap

helm-ag-map and helm-do-ag-map are inherited by helm-map.

Key Action
C-c o Open other window
C-l Search in parent directory
C-c C-e Switch to edit mode
C-x C-s Save ag results to buffer(Ask save buffer name if prefix key is specified)
C-c C-f Enable helm-follow-mode
C-c >, right Move to next file
C-c <, left Move to previous file
C-c ? Show help message

Edit mode keymap

Key Action
C-c C-c Commit changes
C-c C-k Abort
C-c C-d Mark delete line
C-c C-u Unmark

You can use next-error and previous-error for seeing file content which current line indicates.

Saved buffer keymap

Key Action
RET Jump to current line position
C-o Jump to current line position in other window
g Update result

Sample Configuration

(custom-set-variables
 '(helm-ag-base-command "ag --nocolor --nogroup --ignore-case")
 '(helm-ag-command-option "--all-text")
 '(helm-ag-insert-at-point 'symbol)
 '(helm-ag-ignore-buffer-patterns '("\\.txt\\'" "\\.mkd\\'")))

helm-ag.el with other searching tools

helm-ag.el can work other searching tools like platinum searcher or ack instead of the silver searcher. I think the searching tool which supports grep like output, helm-ag can work with it.

the platinum searcher

(custom-set-variables
 '(helm-ag-base-command "pt -e --nocolor --nogroup"))

ack

(custom-set-variables
 '(helm-ag-base-command "ack --nocolor --nogroup"))

sift

(custom-set-variables
 '(helm-ag-base-command "sift --no-color -n"))

ripgrep

Ripgrep uses exit-status 2 to indicate a partial success:

(custom-set-variables
 '(helm-ag-base-command "rg --no-heading")
 `(helm-ag-success-exit-status '(0 2)))

NOTE: For pt and rg users

When using ag or ack, helm-do-ag convert pattern from foo bar to "(?=.*" foo ".*)(?=.*" bar ".*)" which pattern matches line which contains both foo and bar. But when using pt or rg, helm-do-ag does not convert the pattern because Golang regexp(pt is written in Golang) and rust's regex (rg is written in rust) does not support look-a-head pattern. So using pt or rg behaves differently from ag when you use such pattern.

Alternatives

ag.el provides M-x grep interface. Also it can work without helm.

More Repositories

1

god-mode

Minor mode for God-like command entering
Emacs Lisp
849
star
2

git-gutter

Emacs port of GitGutter which is Sublime Text Plugin
Emacs Lisp
830
star
3

helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
Emacs Lisp
688
star
4

org-page

[INACTIVE] A static site generator based on Emacs and org mode.
Emacs Lisp
673
star
5

popwin

Popup Window Manager for Emacs
Emacs Lisp
496
star
6

quickrun

Run command quickly. This packages is inspired quickrun.vim
Emacs Lisp
474
star
7

anzu

Emacs Port of anzu.vim
Emacs Lisp
414
star
8

emamux

tmux manipulation from Emacs
Emacs Lisp
265
star
9

ov

Overlay library for Emacs Lisp.
Emacs Lisp
211
star
10

helm-gtags

GNU GLOBAL helm interface
Emacs Lisp
204
star
11

direx

Directory Explorer for GNU Emacs
Emacs Lisp
204
star
12

terraform-mode

Major mode of Terraform configuration file
Emacs Lisp
194
star
13

git-gutter-fringe

Fringe version of git-gutter.el
Emacs Lisp
160
star
14

req-package

dependency management system on top of use-package
Emacs Lisp
153
star
15

git-messenger

Emacs Port of git-messenger.vim
Emacs Lisp
146
star
16

go-eldoc

eldoc for go language
Emacs Lisp
128
star
17

libegit2

Emacs bindings for libgit2
C
115
star
18

key-chord

Map pairs of simultaneously pressed keys to commands
Emacs Lisp
108
star
19

yascroll

Yet Another Scroll Bar Mode
Emacs Lisp
104
star
20

zoom-window

Zoom and Unzoom window
Emacs Lisp
102
star
21

company-jedi

Company backend for Python jedi
Emacs Lisp
100
star
22

swoop

Peculiar buffer navigation for Emacs
Emacs Lisp
90
star
23

org-redmine

Redmine tools using Emacs OrgMode
Emacs Lisp
83
star
24

dired-k

Highlighting dired buffer like k
Emacs Lisp
82
star
25

magit-gerrit

Magit plugin for Gerrit Code Review
Emacs Lisp
61
star
26

go-add-tags

Add field tags for struct fields
Emacs Lisp
59
star
27

pkg-info

Provide information about Emacs packages
Emacs Lisp
57
star
28

helm-css-scss

This emacs program makes your CSS/SCSS/LESS coding faster and easier than ever.
Emacs Lisp
54
star
29

smeargle

Highlighting Regions by Last Updated Time
Emacs Lisp
49
star
30

evil-anzu

anzu for Evil
Emacs Lisp
49
star
31

mongo

MongoDB driver for Emacs Lisp
Emacs Lisp
47
star
32

manage-minor-mode

Manage your minor-mode on the dedicated interface buffer. Emacs.
Emacs Lisp
47
star
33

gh-md

Render markdown using the github api
Emacs Lisp
46
star
34

farmhouse-themes

Hand-picked light and dark color theme for Emacs 24+
Emacs Lisp
43
star
35

go-direx

Tree style source code viewer for Go language
Emacs Lisp
40
star
36

undohist

Persistent Undo History for GNU Emacs
Emacs Lisp
40
star
37

helm-themes

Emacs theme selection with helm interface
Emacs Lisp
38
star
38

fontawesome

fontawesome utility
Emacs Lisp
33
star
39

go-impl

impl for Emacs
Emacs Lisp
32
star
40

ansible-doc

Ansible documentation for GNU Emacs
Emacs Lisp
32
star
41

sr-speedbar

Same frame speedbar
Emacs Lisp
31
star
42

fancy-battery

Display battery in Emacs Mode line
Emacs Lisp
31
star
43

cpp-auto-include

Insert and delete C++ header files automatically.
Emacs Lisp
31
star
44

helm-open-github

Utilities for opening github page
Emacs Lisp
29
star
45

ac-etags

etags/ctags completion source for auto-complete
Emacs Lisp
28
star
46

transpose-frame

Transpose windows arrangement in a frame
Emacs Lisp
26
star
47

osx-trash

Make Emacs' delete-by-moving-to-trash do what you expect it to do on OS X.
Emacs Lisp
26
star
48

ac-emoji

auto-complete source of Emoji
Emacs Lisp
25
star
49

ac-ispell

ispell/aspell completion source for auto-complete
Emacs Lisp
25
star
50

applescript-mode

Emacs mode for editing AppleScript
Emacs Lisp
24
star
51

codic

Codic for Emacs
Emacs Lisp
23
star
52

magit-svn

Git-Svn extension for Magit
Emacs Lisp
22
star
53

helm-pydoc

pydoc with helm interface
Emacs Lisp
20
star
54

evil-textobj-line

Evil Line text object
Emacs Lisp
18
star
55

ac-alchemist

auto-complete source of alchemist
Emacs Lisp
18
star
56

sourcemap

Sourmap parser in Emacs Lisp
Emacs Lisp
18
star
57

dart-mode

An Emacs mode for the Dart language
Dart
16
star
58

helm-ack

App::ack with helm interface
Emacs Lisp
13
star
59

helm-perldoc

perlpod with helm interface
Emacs Lisp
12
star
60

reverse-theme

Emacs color theme of reverse(like 'emacs --reverse-video')
Emacs Lisp
12
star
61

helm-github-issues

github issues with helm interface
Emacs Lisp
12
star
62

ac-capf

auto-complete source of completion-at-point
Emacs Lisp
12
star
63

sound-wav

Play wav file
Emacs Lisp
12
star
64

ac-racer

auto-complete source of racer
Emacs Lisp
10
star
65

qt-pro-mode

GNU Emacs major-mode for Qt build-system files
Emacs Lisp
9
star
66

popup-complete

Completion with popup-el
Emacs Lisp
9
star
67

splitjoin

Emacs port of splitjoin.vim
Emacs Lisp
8
star
68

miniedit

Enhanced editing for minibuffer fields
Emacs Lisp
8
star
69

helm-ispell

ispell completion with helm interface
Emacs Lisp
8
star
70

thingopt

Additional features of thingatpt.el
Emacs Lisp
8
star
71

helm-package

Listing ELPA packages with helm interface
Emacs Lisp
7
star
72

magit-p4

Magit plugin integrating git-p4 add-on.
Emacs Lisp
6
star
73

docean

Interact with DigitalOcean from Emacs
Emacs Lisp
6
star
74

pyimpsort

Sort python imports
Python
5
star
75

emamux-ruby-test

Ruby test with emamux
Emacs Lisp
5
star
76

octicons

Emacs octicons utility
Emacs Lisp
5
star
77

oberon

Major mode for editing Oberon/Oberon-2 program texts
Emacs Lisp
5
star
78

dedicated

A very simple minor mode for dedicated buffers
Emacs Lisp
4
star
79

haxe-mode

Major mode for editing Haxe files.
Emacs Lisp
4
star
80

helm-robe

Helm completing function for robe
Emacs Lisp
4
star
81

ert-expectations

The simplest unit test framework in the world
Emacs Lisp
4
star
82

keydef

A simpler way to define keys, with kbd syntax
Emacs Lisp
3
star
83

help-find-org-mode

Advise help functions to find org babel source blocks instead of tangled source
Emacs Lisp
3
star
84

test-more

Emacs Test framework like Perl's Test::More
Emacs Lisp
3
star
85

tree-mode

A mode to manage tree widgets
Emacs Lisp
3
star
86

showtip

Show tip at cursor
Emacs Lisp
3
star
87

import-popwin

Pop up buffer near by import statements with popwin
Emacs Lisp
3
star
88

literate-coffee-mode

Major mode for Literate CoffeeScript
Emacs Lisp
3
star
89

perl-utils

Emacs Perl utilities
Emacs Lisp
2
star
90

ltsv

LTSV for Emacs
Emacs Lisp
2
star
91

later-do

Execute lisp code ... later
Emacs Lisp
2
star
92

findr

Breadth-first file-finding facility for (X)Emacs
Emacs Lisp
2
star
93

org-json

Conversion between org and json
Emacs Lisp
2
star
94

dirtree

Directory tree views
Emacs Lisp
2
star
95

pylint

Minor mode for running `pylint'
Emacs Lisp
2
star
96

jedi-eldoc

Eldoc with emacs-jedi
Emacs Lisp
2
star
97

w32-browser

Run Windows application associated with a file
Emacs Lisp
2
star
98

setnu

Emacs Lisp
1
star
99

oddmuse

Edit pages on an Oddmuse wiki
Emacs Lisp
1
star
100

.github

Talk and learn about the Emacsorphanage
Makefile
1
star