diff --git a/sh/.config/sh/alias b/sh/.config/sh/alias index 55b4d9f..0c5c140 100644 --- a/sh/.config/sh/alias +++ b/sh/.config/sh/alias @@ -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