Skip to content

Instantly share code, notes, and snippets.

@vtronko
Created April 8, 2020 05:25
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vtronko/46e3ffc408dde5287dbffe7bb681febf to your computer and use it in GitHub Desktop.
Save vtronko/46e3ffc408dde5287dbffe7bb681febf to your computer and use it in GitHub Desktop.
FZF completion for pacman and yay
fay() {
packages=$(awk {'print $1'} <<< $(yay -Ss $1 | awk 'NR%2 {printf "\033[1;32m%s \033[0;36m%s\033[0m — ",$1,$2;next;}{ print substr($0, 5, length($0) - 4); }' | fzf -m --ansi))
[ "$packages" ] && yay -S $(echo "$packages" | tr "\n" " ")
}
fzfman() {
packages="$(awk {'print $1'} <<< $(pacman -Ss $1 | awk 'NR%2 {printf "\033[1;32m%s \033[0;36m%s\033[0m — ",$1,$2;next;}{ print substr($0, 5, length($0) - 4); }' | fzf -m --ansi --select-1))"
[ "$packages" ] && pacman -S $(echo "$packages" | tr "\n" " ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment