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
6
votes
2 answers

Ignore node_modules with vim-fzf

I have defined a function to search for filename (), and a string () from git root directory asynchronously with fzf.vim plugin (I also have Ag installed). However, I can not manipulate the definition to ignore node_modules directory. The…
Sang
  • 4,049
  • 3
  • 37
  • 47
6
votes
1 answer

Silver Searcher: how to unignore files in the .gitignore?

I have a folder of aliases. These are bash files. Some are sensitive, so I keep them in a .gitignore. ~/.bash_utilities bash_a.sh bash_b.sh .gitignore .gitignore: bash_b.sh The problem is that my Silver Searcher looks at the .gitignore…
WebQube
  • 8,510
  • 12
  • 51
  • 93
5
votes
0 answers

Multiline regex search with ag

I'd like to "AND" search text in spesific multiline range in a file by regex with ag(the_silver_searcher). But the regex pattern not work. Following regex pattern works well. ag --multiline -G "^.*\.(md|txt)$" -C 1 -S "foo(\n|.)*baz"…
k23j4
  • 723
  • 2
  • 8
  • 15
5
votes
2 answers

Search Jupyter notebook markdown cells from command line

I use ag to search through my notes. My notes are written down in Markdown files and Markdown cells contained within Jupyter notebooks. I can search the Markdown files conveniently with ag --markdown .... It would be very handy if something similar…
marnix
  • 1,210
  • 8
  • 12
5
votes
1 answer

site-wide search and replace vim cdo no buffers

I recently switched to vim, and learnt that you can execute searching using AG. I always do :Ag foo And, in the quicklist window :cdo s/foo/bar/g |update However,it opens all the files in buffers.How can I not let Vim open buffers,but let vim…
shigg
  • 792
  • 1
  • 8
  • 24
5
votes
2 answers

How do I add a persistent configuration option to 'ag'?

I have recently begun to use the 'ag' command instead of 'ack'. Ag is much faster, but does not seem to have a file (such as .ackrc) where one could add configuration options. For example, I always want a pager to be used, and I don't want to have…
Nathan Lippi
  • 4,967
  • 5
  • 25
  • 29
5
votes
1 answer

Best GNU Find Replacement

I'm looking for a better find. The reason is that the find user interface is unintuitive to me (in particular, the pruning / -print style) and difficult to wrap in a function due to strict requirements on argument ordering. locate / updatedb isn't…
Stephen Niedzielski
  • 2,497
  • 1
  • 28
  • 34
4
votes
1 answer

How can I use the files found by one ag search as the domain for a second ag search?

Suppose I do ag -l foo. That gets me a list of files. How can I use ag a second time to search within just those files?
joachim
  • 28,554
  • 13
  • 41
  • 44
4
votes
4 answers

how to match all files containing word1 AND word2 across different lines with ag or rg (PCRE/Rust regex)

I've long list of generated reports which I want to filter. The report is something like this: Report Name Report Date Blah blah blah Blah: WORD1 Blah blah blah blah: WORD2 blah blah I'm trying to use ag (PCRE regex) or rg (rust regex) and find all…
SddS
  • 587
  • 1
  • 5
  • 17
4
votes
2 answers

Is silver-searcher able to obtain PATTERN from file?

There are 84 PATTERN need to be check, i store them in file name pattern.txt. Is silver-searcher (also named Ag) able to obtain these patterns from pattern.txt? grep has -f options to read pattern from file, but the man page of silver-searcher…
good5dog5
  • 139
  • 1
  • 2
  • 10
4
votes
2 answers

What is the proper Vim/Ag g:ctrlp_user_command value for Windows?

I would like to fill in the elsif in the portion of my .vimrc below, can anyone help me with the correct Windows syntax? if executable( 'ag' ) if has( 'unix' ) let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' elsif has( 'win32'…
jbm
  • 1,482
  • 11
  • 26
3
votes
3 answers

How to search for text in a specific file type/extension in vim with FZF and Ag?

I have recently started using vim and i have been playing around with it for sometime now. i use FZF with Ag to get searching files and searching in files done. but i am not able to search in particular file types for example i want to search…
hannad rehman
  • 4,133
  • 3
  • 33
  • 55
3
votes
2 answers

How can I exclude lines containing a match found with Ripgrep?

I am using rg (or alternatively ag) to search for occurrences of a string in a folder with many files, like this: $ rg "cat" lolo 3:cat lala 2:cat Now I would like to get rid of these matches. How can I remove each line containing a match from…
TTT
  • 6,505
  • 10
  • 56
  • 82
3
votes
3 answers

What is the best way to find all the files that do not have a match?

I have a large application and I need to find a list of files that do not contain an expression. I have been using The Silver Searcher but I am unsure how to get the opposite Example ag 'breadcrumbs' app/controllers This gives a list of all the…
MZaragoza
  • 10,108
  • 9
  • 71
  • 116
3
votes
3 answers

Is it possible to force silver searcher to search through files on list or chain searches?

To print only names of files which match search there is: ag -l What should I use if I want to grep only through files from list? Or maybe is it possible to chain searches in this way?
yatsek
  • 855
  • 1
  • 10
  • 19