config/shell: little helper fixes
- add xtrace - fix cd with arg number != 1
This commit is contained in:
parent
2c0e42dfa4
commit
f8da1fe449
|
@ -31,7 +31,7 @@ cd() {
|
|||
dir=$(fd --no-ignore --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1)
|
||||
test -n "$dir" && cd "$dir"
|
||||
else
|
||||
builtin cd "$1" &&
|
||||
builtin cd "$@" &&
|
||||
command ls --literal --file-type --color=always --format=vertical -U -w $COLUMNS |
|
||||
#pr -4 -l1 -W $COLUMNS -S" " |
|
||||
head -3
|
||||
|
|
|
@ -33,6 +33,12 @@ alias h='help'
|
|||
compdef help=man
|
||||
alias info='info --vi-keys'
|
||||
|
||||
xtrace() {
|
||||
set -x
|
||||
"$@"
|
||||
set +x
|
||||
}
|
||||
|
||||
# Shows source code for command, resolving nested aliases
|
||||
wh() {
|
||||
res=$(which "$@")
|
||||
|
@ -164,7 +170,7 @@ alias kc='kdeconnect-cli --refresh && kdeconnect-cli --list-devices'
|
|||
|
||||
# Shortcuts
|
||||
alias logoff="loginctl terminate-user $USER"
|
||||
alias calc='rlwrap -a bc -l'
|
||||
alias calb='rlwrap -a bc -l'
|
||||
alias dt='python -c "import time;print(time.asctime(time.localtime()))"'
|
||||
|
||||
# Process
|
||||
|
@ -175,7 +181,11 @@ alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
|||
|
||||
# Remote
|
||||
alias delta="sc restart openvpn-client@deltaPeak.service"
|
||||
alias sshl="lemonade server -allow 127.0.0.1 & kitty +kitten ssh -R 2489:127.0.0.1:2489"
|
||||
sshl() {
|
||||
lemonade server -allow 127.0.0.1 &
|
||||
ssh-copy-id -i "$(ssh -G "$1" | grep "^identityfile " | head -1 | cut -d " " -f2- | sed "s|^~|$HOME|")" "$1"
|
||||
kitty +kitten ssh -R 2489:127.0.0.1:2489 "$@"
|
||||
}
|
||||
|
||||
# Listen to loopback of mic
|
||||
alias listen='pactl load-module module-loopback; echo "Press Enter to stop"; read; pactl unload-module module-loopback'
|
||||
|
@ -206,7 +216,6 @@ alias hx='sudo hexedit --maximize --color'
|
|||
# Paginated hexyl
|
||||
hex() { hexyl "$@" | "${PAGER:-less}" }
|
||||
|
||||
|
||||
alias dic="cat $XDG_DATA_HOME/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzf --tiebreak=length --bind='alt-bspace:clear-query'"
|
||||
alias dict="rlwrap rdictcc -d $XDG_DATA_HOME/dictcc"
|
||||
alias dictu="dict -i $XDG_DATA_HOME/dictcc/dict.txt"
|
||||
|
|
|
@ -5,13 +5,13 @@ for f in "$@"
|
|||
do
|
||||
test -w "$f" && elevate="" || elevate=sudo
|
||||
if test -d "$f"; then
|
||||
find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||
if test -e "$f/.git" || test -e "$f/packed-refs"
|
||||
then echo -n "Force delete git project $f? "
|
||||
read answer
|
||||
test "$answer" = "y" &&
|
||||
$elevate rm -rf "$f"
|
||||
else find "$f" -maxdepth 4 -not -name ".stfolder" -empty -printf "Removing empty %p\n" -delete
|
||||
test -e "$f" &&
|
||||
else test -e "$f" &&
|
||||
echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 &&
|
||||
$elevate rm -rI "$f"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue