diff --git a/sh/.config/sh/alias b/sh/.config/sh/alias index 0c5c140..8891ea5 100644 --- a/sh/.config/sh/alias +++ b/sh/.config/sh/alias @@ -49,14 +49,21 @@ if exist fzf; then # Fuzzy search packages to install if exist yay; then - alias fzfyay="yay -Slq | fzf -m --preview 'yay -Si {1}' | xargs -ro yay -S" - # Fuzzy uninstall packages - alias fzfyayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns" + fzf_pkg_tool=yay + elif exist paru; then + fzf_pkg_tool=paru fi + # shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically + if [ -n "$fzf_pkg_tool" ]; then + alias fzfyay="$fzf_pkg_tool -Slq | fzf -m --preview '$fzf_pkg_tool -Si {1}' | xargs -ro $fzf_pkg_tool -S" + # Fuzzy uninstall packages + alias fzfyayrns="$fzf_pkg_tool -Qeq | fzf -m --preview '$fzf_pkg_tool -Qi {1}' | xargs -ro $fzf_pkg_tool -Rns" + fi + unset fzf_pkg_tool # ripgrep-all to fzf search through any documents if exist rga; then - rgafzf() { + fzfrga() { RG_PREFIX="rga --files-with-matches" xdg-open "$( FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \ diff --git a/sh/.config/sh/env b/sh/.config/sh/env index d6ff82d..1b902a1 100644 --- a/sh/.config/sh/env +++ b/sh/.config/sh/env @@ -48,5 +48,5 @@ if [ "$(find /usr/share/terminfo -name "$TERMINAL*" | wc -l)" -eq 0 ] || [ -z "$ fi if exist fzf; then - export FZF_DEFAULT_OPTS="--bind 'tab:toggle+down,shift-tab:toggle+up,ctrl-g:top,ctrl-t:toggle-preview,ctrl-d:preview-half-page-down,ctrl-u:preview-half-page-up' --color=light -1 -m --delimiter : --preview 'nl {1}' --preview-window +{2}-5" + export FZF_DEFAULT_OPTS="--bind 'tab:toggle+down,shift-tab:toggle+up,ctrl-g:top,ctrl-t:toggle-preview,ctrl-d:preview-half-page-down,ctrl-u:preview-half-page-up' --color=light -1 -m --delimiter :" fi