I want to use ripgrep on my Ubuntu 20 machine. I have installed it from various repos (apt, snap, cargo) and even built it myself but have always run into the same problem:
According to the manual one should be able to just run
rg 'pattern'
and ripgrep will just recursively search in the current working dir. However for me it always seems to expect a path specifier as well, shown by the fact that it will not find a match even if a file with the pattern is present in the top level of the current directory.
Ripgrep will only work if I do something like:
rg 'pattern' *
This would be not too much of a problem, but I intend to use ripgrep in a vim-addon which expects the behavior from the manual. So the question is: why does ripgrep behave so strangely and how do I fix the behavior?
Edit:
Running the command with the --debug
flag gives the following output:
DEBUG|grep_regex::literal|grep-regex/src/literal.rs:59: literal prefixes detected: Literals { lits: [Complete(test)], limit_size: 250, limit_class: 10 }
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 11 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 11 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 11 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 11 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|globset|globset/src/lib.rs:430: glob converted to regex: Glob { glob: "**/*", re: "(?-u)^(?:/?|.*/)[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true }, tokens: Tokens([RecursivePrefix, ZeroOrMore]) }
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes
DEBUG|globset|globset/src/lib.rs:435: built glob set; 0 literals, 0 basenames, 11 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|ignore::walk|ignore/src/walk.rs:1639: ignoring ./.cache: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("./.gitignore"), original: "*", actual: "**/*", is_whitelist: false, is_only_dir: false })))
...
and then it is the same as the last line for each subfolder of my home directory.
ripgrep
installed using apt from standard Ubuntu repos works as expected for me. Can you do awhich rg
to make sure you're calling the executable you expect?which rg
shows/usr/bin/rg
which I guess is what I expect.As stated above I have also compiled ripgrep from source and still face the same problem of having to specify a glob after my search.echo "test" > test && rg "test"
. Note that this will overwrite any file called "test" in your current working directory so change the name if that causes you problems.--debug
yield any hints?