Questions tagged [ag]

The Silver Searcher, better known as Ag is a tool similar to ack.

The Silver Searcher, better known as Ag is an open-source tool similar to created and maintained by Geoff Greer.

115 questions
50
votes
10 answers

Silver Searcher - How to ignore a file

According to the docs, it should be --ignore PATTERN I have a file containing tags, named "tags". I have tried the following, each of them still searches through the tag file.. ag -Qt --ignore ".*tags" "asdf" ag -Qt --ignore .*tags "asdf" ag -Qt…
Jacob Wang
  • 4,411
  • 5
  • 29
  • 43
45
votes
2 answers

silver searcher ignore multiple directories

using The silver searcher how can I ignore multiple directories? I tried ag foo --ignore-dir dir1,dir2 but it doesn't work.
Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
29
votes
1 answer

Silver Searcher: how to return filename without path

I am using Silver Searcher to find information in my Calibre library which, by default uses long directory and filenames that are a bit redundant. Example search: chris@ODYSSEUS:~/db/ebooks/paper-art$ ag --markdown angel Christophe Boudias…
Chris
  • 871
  • 1
  • 10
  • 19
21
votes
3 answers

Ignore long lines in silversearcher

Right now I am using: ag sessions --color|cut -b1-130 But this will cause color artifacts if the search match is cut bu the cut command. Silversearcher has this in the docs: --print-long-lines Print matches on very long lines (> 2k…
exebook
  • 32,014
  • 33
  • 141
  • 226
21
votes
4 answers

Count total number of matches in directory with ag

I'm attempting to find the number of matches for a given string across a large project. Currently, to do this with ag I am using the following command: $ echo 0$(ag -c searchterm | sed -e "s/^.*:/+/") | bc which is obviously a bit lengthy and not…
SnoringFrog
  • 1,479
  • 1
  • 16
  • 30
17
votes
4 answers

Searching multiple patterns (words) with ack?

I want to search multiple patterns in a directory containing recursive directories and files. I know command for grep which is as follows grep -e '(pattern1)|(pattern2)' or grep -r -E 'string1|string2|string3' /var/www/http What is the command…
Sandip Pingle
  • 647
  • 2
  • 14
  • 37
16
votes
3 answers

How to enable AG in vim + fzf

I am new to vim. I read online that one of the best fuzzy finder in vim is fzf. I have started using it. But whenever I write the command :Ag I get ag is not found. I don't know what it means and I don't know how to fix it.
odbhut.shei.chhele
  • 5,834
  • 16
  • 69
  • 109
15
votes
1 answer

How can I force ag to find matches in node_modules?

I'm using ag to search a git repo. It doesn't find matches under my node_modules subdirectory. Why not, and how can I control this behavior?
mblakele
  • 7,782
  • 27
  • 45
11
votes
1 answer

ag: search exact string, not a pattern

My Problem I'm searching for Application(service) in my files using ag. Since ag treats strings as regular expression patterns, I have to escape the parens and use: ag 'Application\(service\)' This is cumbersome and easy to miss, especially when…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
11
votes
1 answer

How to I use ag to search only in current folder (nonrecursive)?

I love ag :: the_silver_searcher but I am wondering how can I perform a search non-recursively. Sometimes I want to search only inside files from my home directory but without looking in subdirectories.
sorin
  • 161,544
  • 178
  • 535
  • 806
10
votes
1 answer

Search through .zst text files

I have large zstd-compressed text files. How can I run fast search over them ? Can I use AG (The Silver Searcher) or something similar ? I've tried AG but it doesn't work, I have a "failed to load error" : ag -z -i "term"
titibouboul
  • 1,348
  • 3
  • 16
  • 30
10
votes
3 answers

silver_searcher (ag) with multiple search expressions?

Does silver_searcher support specifying multiple search expressions something like -e in grep? I could not find any option in the document/help.
justrajdeep
  • 855
  • 3
  • 12
  • 29
9
votes
2 answers

How do I configure ctrlp to work correctly with ag outside of a git repo?

I use ag with ctrlp, as suggested here: if executable('ag') set grepprg=ag\ --nogroup\ --nocolor let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' let g:ctrlp_use_caching = 0 else let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' let…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
7
votes
1 answer

zstd: error 70 : Write error : Broken pipe (cannot write decoded block)

I'm trying through Windows terminal to decompress a large number of compressed files with zstd v1.4.0 and then 'ag' search over : zstd -dc -r . | ag -z -i "term" It gives me the following error while proceeding : zstd: error 70 : Write error :…
titibouboul
  • 1,348
  • 3
  • 16
  • 30
7
votes
1 answer

How do I use ack or ag within vim with Unite.vim?

I have found a lot of pages with config examples such as: let g:unite_source_grep_command = 'ag' let g:unite_source_grep_default_opts = \ '--line-numbers --nocolor --nogroup --hidden --ignore ' let g:unite_source_grep_recursive_opt = '' or " Use…
Jeff
  • 1,051
  • 1
  • 13
  • 26
1
2 3 4 5 6 7 8