config/shell: tweak some helpers

This commit is contained in:
xeruf 2022-05-03 09:38:55 +02:00
parent e5ed1e7fa8
commit 1037eef3b8
3 changed files with 6 additions and 5 deletions

View File

@ -34,7 +34,7 @@ cl() {
cd() {
if test -d "$DATA" && test "${1:--}" != "-" -a ! -d "$1" -a $# -eq 1
then
dir=$(fd --no-ignore --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1)
dir=$(fd --no-ignore --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1 2>/dev/null)
test -n "$dir" && cd "$dir"
else
builtin cd "$@" &&

View File

@ -104,7 +104,7 @@ edshell() {
(*) file="$(find $CONFIG_SHELLS -name "$1*" | head -1 | grep . || echo "$CONFIG_SHELLS/$1")";;
esac
test -f "$file" && checksum="$(md5sum "$file")"
$EDITOR "$(test "$line" && echo "+normal! ${line}ggzx" || echo "--")" "${file%:*}"
$EDITOR "$(test "$line" && case "$EDITOR" in (nvim) echo "+normal! ${line}ggzx";; (*vi*) echo "+$line";; esac || echo "--")" "${file%:*}"
test -s "$file" || return 1
test "$checksum" != "$(md5sum $file)" && rs
}
@ -220,12 +220,13 @@ u() {
alias dns="drill any @8.8.8.8 -Q"
alias delta="sudo systemctl restart openvpn-client@deltaPeak.service || jcl --unit openvpn-client@deltaPeak.service"
sshl() {
test "$1" = "-a" && shift && local all=true
lemonade server -allow 127.0.0.1 &
local authcache
authcache="/var/tmp/ssh-keys"
local authcache="/var/tmp/ssh-keys"
mkdir -p "$authcache"
file="$authcache/$1"
if test ! -e "$file"; then
test "$all" && pass scp ~/.bash_aliases "$@:"
if ! ssh -G "$1" | grep --silent "^user root$" && touch "$file"; then
ssh-copy-id -i "$(ssh -G "$1" | grep --max-count 1 "^identityfile " | cut -d " " -f2- | sed "s|^~|$HOME|")" "$1" && touch "$file"
TERM=xterm-256color kitty +kitten ssh -R 2489:127.0.0.1:2489 "$@"

View File

@ -69,7 +69,7 @@ export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(t
# TODO put into config file and use --exclude-from
export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__"
export DIRS_IGNORE_SAFE="-x .sync -x .stfolder -x .cache -x .cpan -x *Cache -x .pyenv -x .local/cache -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows $DIRS_GENERATED"
export DIRS_IGNORE="-x *build -x .git -x .idea -x out -x *cache -x Partitions $DIRS_IGNORE_SAFE"
export DIRS_IGNORE="-x *build -x .git -x .idea -x env -x out -x cache -x Partitions $DIRS_IGNORE_SAFE"
# red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
# software config