Questions tagged [ripgrep]

ripgrep (rg) is a line-oriented search tool, similar to grep or ack, that recursively searches your current directory for a regex pattern. Use this tag for questions about using ripgrep.

ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern. By default, ripgrep will respect your .gitignore and automatically skip hidden files/directories and binary files. ripgrep has first class support on Windows, macOS and Linux, with binary downloads available for every release. ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.

User Guide

58 questions
22
votes
1 answer

search start/end of word with ripgrep

With grep I can search for the start and end of a word with grep -e '\' this would find I have a leg. but not play allegro here. Ripgrep (0.10.0) does not seem to support this way of writing this regular expression. My…
pseyfert
  • 3,263
  • 3
  • 21
  • 47
17
votes
5 answers

grep or ripgrep: How to find only files that match multiple patterns (not only on the same line)?

I'm searching for a fast method to find all files in a folder which contain 2 or more patterns grep -l -e foo -e bar ./* or rg -l -e foo -e bar show all files containing 'foo' AND 'bar' in the same line or 'foo' OR 'bar' in different lines but I…
maikelmeyers
  • 288
  • 3
  • 9
17
votes
1 answer

Ripgrep Missing Character Class + Repetitions

Why do these match: echo 'CCAGCTACTCGGGAGGCTGAGGCTGGAGGATCGCTTGAGTCCAGGAGTTC' | grep -E 'CCAGCTACTCGGGAGGCTGAGGCTGGAGGATCGCTTGAGTCCAGGAG[ATCG]{2}C' echo 'CCAGCTACTCGGGAGGCTGAGGCTGGAGGATCGCTTGAGTCCAGGAGTTC' | rg…
Stats4224
  • 778
  • 4
  • 13
12
votes
1 answer

Ripgrep to only exclude a file in the root of the folder

If I have my folder like this: dir: ├── 1.index1.html ├── 2.index2.html ├── 3.index3.html ├── a │ ├── 1.index1.html │ How can I tell ripgrep in the command to exclude only the file index1.html in the root folder, but…
aNaN
  • 167
  • 1
  • 1
  • 8
11
votes
2 answers

Is it possible to display result of Rg into quick fix window?

When i am searching :Rg , it is opening the result in FZF buffer. Often the filenames are not displayed fully in it. Also the once escaped the results are gone. I have to do research if need to check the same word again. but :vim /pattern/g…
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
10
votes
2 answers

pipe ripgrep search results to vim and open files at exact search location

rg -l "searched phrase" | xargs vim populates vim with searched terms, but I need to search for them once again, this time in vim. How to pipe ripgrep search results to vim, so searched files will be opened at exact search location (line and…
LookAheadAtYourTypes
  • 1,629
  • 2
  • 20
  • 35
9
votes
4 answers

Chronic ripgrep / vim Plugin Error on Load: "-complete Used Without -nargs"?

I recently added ripgrep to my list of vim plugins and, immediately after installation, I began receiving this error message whenever I loaded up vim: Error detected while processing…
iamthelabhras
  • 351
  • 2
  • 12
8
votes
1 answer

How do I fuzzy find all files containing specific text using ripgrep and fzf and open it VSCode

I have the following command to fuzzy find files in the command line and to open the selected file in VSCode.: fzf --print0 -e | xargs -0 -r code Now I want to be able to search also file contents for a string. I am able to find the searched string…
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
7
votes
3 answers

Is there a way to escape quotes in ripgrep for MS Windows (Powershell or CMD)?

I want to find a string "Hello (Hello starts with double quote) in text files using ripgrep. Normally, in Bash or ZSH, this would work by escaping with backslash or surrounding with single quote: rg \"Hello rg '"Hello' However, in MS Windows…
Daniel Kim
  • 926
  • 1
  • 9
  • 17
5
votes
1 answer

Many rg commands started by vscode that consume 99% of CPUs

I'm working inside a very big github repo, say its structure is like project-root ├── project-1 │   ├── subproject-a │   └── subproject-others └── project-2 ├── subproject-b └── subproject-others There are many projects, each contains many…
zyxue
  • 7,904
  • 5
  • 48
  • 74
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
2 answers

FZF VIM: removing leading portion of absolute path

I am using the following to search my project: let g:fzf_directories = join( \ [ \ "/some/long/path/to/project/dir", \ "more paths here..." \ ], ' ') let $FZF_DEFAULT_COMMAND = "rg --files --hidden --smart-case " .…
eclipse
  • 2,831
  • 3
  • 26
  • 34
4
votes
2 answers

ripgrep to find files which contain multiple words, possibly on different lines?

If i have files like: cat file1.txt foo bar cat file2.txt foo baz cat file3.txt bar baz Is there a command on ripgrep (or similar) that will search for e.g. files containing foo and bar? E.g. it will display file1.txt but not the other two files?…
Pete
  • 53
  • 4
4
votes
2 answers

Using Ripgrep with flags in fzf.vim

I am using function below to search content in files with ripgrep using fzf in vim function! RipgrepFzf(query, fullscreen) let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true' let initial_command =…
Tarun
  • 1,888
  • 3
  • 18
  • 30
3
votes
1 answer

How to keep search window?

Disclaimer: I don't know all the correct terminology here. When I say "window" it might be "quickfix modal dialog" or something. I am using Neovim (through Neovide) and have these settings to enable search via the fzf plugin, by way of ripgrep: "…
davidkomer
  • 3,020
  • 2
  • 23
  • 58
1
2 3 4