From 37ad8ad62f3d73667dc03007b2d4c18da6feae62 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 8 Jun 2021 20:44:42 +0200 Subject: [PATCH] config/shell: hex alias & yzf fixes --- .config/shell/arch | 10 +++++----- .config/shell/functions | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.config/shell/arch b/.config/shell/arch index 6974a23..1bac7c0 100644 --- a/.config/shell/arch +++ b/.config/shell/arch @@ -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" diff --git a/.config/shell/functions b/.config/shell/functions index 84e3824..798800c 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -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'