2020-10-14 12:16:36 +00:00
|
|
|
which pacman >/dev/null || return 0
|
2020-10-12 20:20:06 +00:00
|
|
|
|
2020-11-30 21:13:43 +00:00
|
|
|
alias dragon='dragon-drag-and-drop'
|
|
|
|
|
2020-10-12 20:20:06 +00:00
|
|
|
# Arch aliases
|
2020-11-14 01:26:30 +00:00
|
|
|
alias pac='noglob sudo pacman'
|
2020-10-12 20:20:06 +00:00
|
|
|
alias pacs='pac -Syu --needed'
|
2021-06-18 16:05:51 +00:00
|
|
|
alias pacr='pac -R --recursive'
|
2021-06-06 16:35:43 +00:00
|
|
|
alias yays='noglob yay -Sy --needed'
|
2021-06-18 16:05:51 +00:00
|
|
|
alias yayr='noglob yay -R --cascade --recursive'
|
2021-09-18 20:02:28 +00:00
|
|
|
alias yau='yay -Syu --sudoloop --nobatchinstall'
|
2020-11-14 01:26:30 +00:00
|
|
|
|
|
|
|
yzf() {
|
2021-06-06 16:35:43 +00:00
|
|
|
pos=$1
|
|
|
|
shift
|
|
|
|
sed "s/ /\t/g" |
|
2021-09-18 20:02:28 +00:00
|
|
|
fzf --nth=$pos --multi --history="${FZF_HISTDIR:-$XDG_STATE_HOME/fzf}/history-yzf$pos" \
|
2021-06-06 16:35:43 +00:00
|
|
|
--preview-window=60%,border-left \
|
2021-09-18 20:02:28 +00:00
|
|
|
--bind="double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}'),alt-enter:execute(xdg-open 'https://aur.archlinux.org/packages?K={$pos}&SB=p&SO=d&PP=100')" \
|
2021-06-08 18:44:42 +00:00
|
|
|
"$@" | cut -f$pos | xargs
|
2020-11-14 01:26:30 +00:00
|
|
|
}
|
2021-06-06 16:35:43 +00:00
|
|
|
|
2021-06-08 18:44:42 +00:00
|
|
|
# print -s adds a shell history entry
|
2020-10-23 12:00:41 +00:00
|
|
|
yas() {
|
2021-06-06 16:35:43 +00:00
|
|
|
cache_dir="/tmp/yas"
|
2021-09-18 20:02:28 +00:00
|
|
|
test "$1" = "-y" && rm -r "$cache_dir" && shift
|
2021-06-06 16:35:43 +00:00
|
|
|
mkdir -p "$cache_dir"
|
2021-06-05 18:26:27 +00:00
|
|
|
preview_cache="$cache_dir/preview_{2}"
|
2021-06-06 16:35:43 +00:00
|
|
|
list_cache="$cache_dir/list"
|
2021-09-18 20:02:28 +00:00
|
|
|
pkg=$( (cat "$list_cache$@" 2>/dev/null || { pacman --color=always -Sl "$@"; yay --color=always -Sl aur "$@" } | sed 's/ [^ ]*unknown-version[^ ]*//' | tee "$list_cache$@") |
|
2021-06-24 10:59:45 +00:00
|
|
|
yzf 2 --tiebreak=index --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache")
|
2021-06-05 18:26:27 +00:00
|
|
|
if test -n "$pkg"
|
2021-06-06 16:35:43 +00:00
|
|
|
then echo "Installing $pkg..."
|
2021-07-03 18:59:33 +00:00
|
|
|
cmd="yay -S --sudoloop --nobatchinstall $pkg"
|
2021-06-05 18:26:27 +00:00
|
|
|
print -s "$cmd"
|
|
|
|
eval "$cmd"
|
2021-06-24 20:08:32 +00:00
|
|
|
rehash
|
2021-06-05 18:26:27 +00:00
|
|
|
fi
|
2020-10-23 12:00:41 +00:00
|
|
|
}
|
2020-11-14 01:26:30 +00:00
|
|
|
yar() {
|
2021-06-24 10:59:45 +00:00
|
|
|
pkg=$(yay --color=always -Q "$@" | yzf 1 --tiebreak=length --preview="yay --color always -Qli {1}")
|
2021-06-05 18:26:27 +00:00
|
|
|
if test -n "$pkg"
|
|
|
|
then echo "Removing $pkg..."
|
2021-06-18 16:05:51 +00:00
|
|
|
cmd="yay -R --cascade --recursive $pkg"
|
2021-06-05 18:26:27 +00:00
|
|
|
print -s "$cmd"
|
|
|
|
eval "$cmd"
|
|
|
|
fi
|
2020-11-14 01:26:30 +00:00
|
|
|
}
|
2020-10-12 20:20:06 +00:00
|
|
|
|