fish: Add shortcuts for searching with ripgrep within in a file

This is primarily to help us with grepping in gstreamer logs.
This commit is contained in:
Sanchayan Maity 2021-07-10 11:13:56 +05:30
parent a493297cae
commit a148531d3f
1 changed files with 12 additions and 0 deletions

View File

@ -306,6 +306,18 @@ function ffr --description "Git restore a file using fzf"
git restore $argv -- (git ls-files --modified --exclude-standard | fzf -m)
end
function grf --description "Search within a file with grep with context"
grep --color=always -C 10 --group-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | less -R
end
function rgf --description "Search within a file with ripgrep"
rg --color always $argv | nvim -R +AnsiEsc
end
function rgc --description "Search within a file with ripgrep with context"
rg --color always -C 10 --context-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | nvim -R +AnsiEsc
end
fzf_key_bindings
starship init fish | source