config/shell: update ssh aliases and d

TERM=xterm-256color was actually leftover from alacritty
This commit is contained in:
xeruf 2022-08-04 10:52:16 +02:00
parent f257f2cc03
commit 195bc743d2
2 changed files with 9 additions and 7 deletions

View File

@ -93,10 +93,12 @@ d() {
local query="$(zoxide-list "$@")"
# First find out whether there is an obvious match
# (score at least ten times above runner-up and score above 20)
# which is not the current directory
# If not select with fzf, using locate to find extra options
target="$(if test -n "$query" &&
expr "$(echo "$query" | sed 's| \+\([^ ]\+\).*|\1|;q')" \> 20 \& \
$(echo "$query" | sed 'N;s|/.* \([0-9]\+\)|> 10 * \1|;q' | sed 's| */.*||') >/dev/null #2>&1
$(echo "$query" | sed 'N;s|/.* \([0-9]\+\)|> 10 * \1|;q' | sed 's| */.*||') >/dev/null &&
[[ ! "$(echo "$query" | head -1)" =~ ".*$PWD" ]]
then echo "$query" | head -1
else test -n "$query" && echo "$query"; locate-zox "$@"
fi | zoxide-fzf)"

View File

@ -216,9 +216,9 @@ u() {
which pacman-mirrors >/dev/null &&
sudo pacman-mirrors --geoip
which pacman >/dev/null &&
sudo pacman -Syy --needed gnupg archlinux-keyring &&
sudo pacman-key --populate archlinux &&
sudo pacman-key --refresh-keys
sudo pacman -Syyu --needed gnupg archlinux-keyring
#sudo pacman-key --populate archlinux &&
#sudo pacman-key --refresh-keys
if which topgrade >/dev/null
then
topgrade
@ -237,6 +237,7 @@ dns() {
drill A @8.8.8.8 -Q "$@"
drill AAAA @8.8.8.8 -Q "$@"
}
alias sshk='kitty +kitten ssh'
sshl() {
test "$1" = "-a" && shift && local all=true
lemonade server -allow 127.0.0.1 &
@ -245,7 +246,7 @@ sshl() {
file="$authcache/$1"
test "$all" && pass scp ~/.bash_aliases "$@:"
if ssh -G "$1" | grep --silent "^user root$" && ! [[ "$1" =~ "pve*" ]]
then TERM=xterm-256color pass ssh "$@"
then pass ssh "$@"
else
test ! -e "$file" &&
ssh-copy-id -i "$(ssh -G "$1" |
@ -253,8 +254,7 @@ sshl() {
cut -d " " -f2- |
sed "s|^~|$HOME|")" "$1" &&
touch "$file"
$(case $TERM in (*-kitty) TERM=xterm-256color echo 'kitty +kitten';; esac) ssh -R 2489:127.0.0.1:2489 "$@"
return $?
$(case $TERM in (*-kitty) echo 'kitty +kitten';; esac) ssh -R 2489:127.0.0.1:2489 "$@"
fi
}