config/shell: hex alias & yzf fixes

This commit is contained in:
xeruf 2021-06-08 20:44:42 +02:00
parent 284b05c3d7
commit 37ad8ad62f
2 changed files with 7 additions and 5 deletions

View File

@ -16,17 +16,17 @@ yzf() {
fzf --nth=$pos --multi --tiebreak=length --history=/var/tmp/fzf-history-yzf$pos \
--preview-window=60%,border-left \
--bind="double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}')" \
"$@" | cut -f$pos | tr '\n' ' '
"$@" | cut -f$pos | xargs
}
# print -s adds a history entry
# print -s adds a shell history entry
yas() {
cache_dir="/tmp/yas"
mkdir -p "$cache_dir"
preview_cache="$cache_dir/preview_{2}"
list_cache="$cache_dir/list"
pkg=$((cat "$list_cache" 2>/dev/null || yay --color always -Sl | tee "$list_cache") |
yzf 2 --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache" "$@")
pkg=$((cat "$list_cache$@" 2>/dev/null || yay --color=always -Sl "$@" | tee "$list_cache$@") |
yzf 2 --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache")
if test -n "$pkg"
then echo "Installing $pkg..."
cmd="yay -S $pkg"
@ -35,7 +35,7 @@ yas() {
fi
}
yar() {
pkg=$(yzf 1 -q "$@" --preview "yay --color always -Qli {1}")
pkg=$(yay --color=always -Q "$@" | yzf 1 --preview="yay --color always -Qli {1}")
if test -n "$pkg"
then echo "Removing $pkg..."
cmd="yay -R $pkg"

View File

@ -201,6 +201,8 @@ alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r -i mv {} /tmp"
unv() { strings $1 | sed 's/5$//' | dedup }
hex() { hexyl "$@" | "${PAGER:-less}" }
# Applications
alias dict="(builtin cd $XDG_DATA_HOME/dictcc && rlwrap perl dictcc-helper.pl)"
alias startMinecraftServer='curl https://ipinfo.io/ip | xclip -sel clip && cd ~/daten/games/sharedgames/minecraft/server && java -jar forge-1.12.2-14.23.5.2768-universal.jar -mx 8G'