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:
Marty Oehme 2020-11-25 11:36:21 +01:00
parent ede86bc384
commit fb9f3b83a4
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -53,6 +53,20 @@ if exist fzf; then
# Fuzzy uninstall packages # Fuzzy uninstall packages
alias fzfyayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns" alias fzfyayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns"
fi 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 fi
# vifm # vifm