config/shell: bash compatibility and corrections

This commit is contained in:
xeruf 2022-05-16 23:47:19 +02:00
parent 487a7011ac
commit bff3e7d7b2
6 changed files with 12 additions and 6 deletions

View File

@ -16,7 +16,7 @@
},
"main": {
"lang": "auto",
"lastfolder": "/home/janek/data/4-media/music/Mixes",
"lastfolder": "/home/janek/data/4-media/music",
"maximized": false
},
"playlist": {
@ -137,4 +137,4 @@
"Artist splitting"
]
}
}
}

View File

@ -65,7 +65,7 @@ alias uloc='noglob sudo updatedb && loci'
locei() { locate --all --basename "\\$1" "$@" | fselect }
alias loce='noglob locei'
# locate all
alias loca='noglob sudo updatedb --prunenames "" --prunefs "" --prunepaths "/var/cache" -o /var/cache/locate-all.db && loci --database /var/cache/locate-all.db'
alias loca='noglob sudo updatedb -l 0 --prunenames "" --prunefs "tmpfs sysfs debugfs" --prunepaths "/var/cache" --debug-pruning -o /var/cache/locate-all.db && loci --database /var/cache/locate-all.db'
# ZOXIDE {{{1
alias c=z

View File

@ -156,6 +156,7 @@ alias scue='systemctl --user enable --now'
alias scud='systemctl --user disable --now'
# Reload or restart matching systemctl service
unalias scr 2>/dev/null
scr() {
echo -n "User: "
systemctl --user reload-or-restart "$1" ||
@ -263,6 +264,9 @@ alias mdox="xclip -o -selection clipboard | mdo | xclip -filter"
alias f="fossil"
alias fs="fossil status"
alias fc="fossil commit -v"
fdf() {
fossil diff "$@" | diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less -F
}
alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'

View File

@ -11,6 +11,6 @@ XDG_DOWNLOAD_DIR="$HOME/data/5-incubator"
XDG_MUSIC_DIR="$HOME/data/4-media/music"
XDG_PICTURES_DIR="$HOME/data/4-media/images"
XDG_VIDEOS_DIR="$HOME/data/4-media/videos"
XDG_DOCUMENTS_DIR="$HOME/data/3-dox"
XDG_DOCUMENTS_DIR="$HOME/data/4-media/multimedia"
XDG_NOTES_DIR="$HOME/data/2-box"
#XDG_PUBLICSHARE_DIR="$HOME/data/3-resources/multimedia"

View File

@ -44,6 +44,7 @@ fi
highlight "d :: recursively remove development caches"
if [[ $1 =~ "d" ]]; then
find -maxdepth 1 \( -name "*.aux" -o -name "*.log" -o -name "*.toc" -o -name "*.out" \) -print -delete
find -name "src" -prune -o \
-type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name \1|g') \) \
-print -exec rm $i -r {} + -prune

View File

@ -12,7 +12,8 @@ case "$cmd" in
info --vi-keys $(test "$last" != zsh && echo "--index-search=$last") zsh ||
LESS="$LESS +/^ *$last *\\[" man zshall;;
(gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr) unbuffer "$@" --help | $paginate;;
(caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && { fossil ui "$repo" & exit; }
(caddy|stretchly|go|fossil) test "$cmd" = "fossil" -a $# -eq 1 && repo="$(locate -b -l 1 "fossil*.fossil")" && fossil ui "$repo" && exit
# TODO view fossil ui in terminal
shift
"$cmd" help "$@" | $paginate;;
(rails) { rails -H && rails --help; } | $paginate;;
@ -22,7 +23,7 @@ case "$cmd" in
(pandoc) man pandoc; highlight "Extensions" && pandoc --list-extensions | paste -s -d' ';;
(swaymsg) test $# -gt 1 && shift && man sway "$@" || man swaymsg;;
(swaymsg-*) man sway "${1#swaymsg-}";;
(*) { info "$cmd" -w | grep -v "manpages" && pinfo "$@"; } ||
(*) { which info >/dev/null 2>&1 && info "$cmd" -w | grep -v "manpages" && pinfo "$@"; } ||
man "$@" ||
if which "$cmd" >/dev/null
then { "$@" --help || { test $? == 1 && "$@" -help; } || { test $? == 1 && "$@" -h; }; } 2>&1 | $paginate