How can I configure ripgrep to always search from my home directory?

520 Views Asked by At

How can I configure my ~/.ripgreprc glob(s) to always search from the home directory regardless of where I run rg from?

1

There are 1 best solutions below

0
On BEST ANSWER

I'm pretty sure you can't configure ripgrep to do that, and it would be a bad idea to do that if you could, but you can make a shell function to do what you want.

Put this in your ~/.bashrc:

function rgh()
{
    rg "$@" ~/
}

Then you just rgh whatever and it will expand to rg whatever ~/.

(I chose rgh for "ripgrep home" but you can call it whatever you want.)