sh: Add fuzzy ripgrep-all search
Added function to fuzzily search through any documents using rga. Function code adapted from https://github.com/phiresky/ripgrep-all Can be interactively searched, should be reasonably fast once indexing is finished.
This commit is contained in:
parent
ede86bc384
commit
fb9f3b83a4
1 changed files with 14 additions and 0 deletions
|
@ -53,6 +53,20 @@ if exist fzf; then
|
|||
# Fuzzy uninstall packages
|
||||
alias fzfyayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns"
|
||||
fi
|
||||
|
||||
# ripgrep-all to fzf search through any documents
|
||||
if exist rga; then
|
||||
rgafzf() {
|
||||
RG_PREFIX="rga --files-with-matches"
|
||||
xdg-open "$(
|
||||
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
||||
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
||||
--phony -q "$1" \
|
||||
--bind "change:reload:$RG_PREFIX {q}" \
|
||||
--preview-window="70%:wrap"
|
||||
)"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
# vifm
|
||||
|
|
Loading…
Reference in a new issue