config: little overall improvements

This commit is contained in:
xeruf 2021-11-09 05:37:07 +01:00
parent be7a4e5732
commit 64f6dc952b
6 changed files with 13 additions and 6 deletions

View File

@ -86,7 +86,8 @@
sv = --paginate status -v
svv = --paginate status -vv
tree = !git ls-tree --full-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
tl = !git ls-tree --full-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
tree = !git ls-tree --name-only -r HEAD | tree -C --fromfile . | ${PAGER:-less}
# repo
r = remote -v

View File

@ -40,7 +40,7 @@ cd() {
}
# LOCATE
alias fselect='fzf -0 -1 --reverse --height=30%'
alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || b "$f"; done'
loci() {
locate --all --ignore-case --basename --existing "$@" |
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | fselect

View File

@ -1,6 +1,11 @@
#!/bin/sh
# Backup root filesystem with borg
cd /
case "$1" in
(-*) name="${1#-}"; shift;;
(*) test $# -gt 0 || cd /;;
esac
name="/mnt/backup/borg::$(test -n "$name" && echo "$name" || cat /etc/hostname)-${1:-system}-$(date -u +"%y%m%d")"
echo "Backing up as $name"
sudo borg create --progress --stats \
$(echo $IGNOREDIRS_PURE -x 'software-challenge/*/build' -x 'emacs/.local' | sed 's|-x \([^ ]\+\)|-e "*/\1" -e \1|g') \
/mnt/backup/borg::$(cat /etc/hostname)-system-$(date -u +"%y%m%d") etc home root
"$name" $(test $# -eq 0 && echo etc home root || test $# -eq 1 && echo $1) "${@:2}"

View File

@ -5,7 +5,7 @@ typeset -A _clean_map
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [c]=/var/cache)
# Directories to always clean
_clean_folders=(~/.ant ~/.autopsy ~/.bundle ~/.cache ~/.cargo ~/.docker ~/.electron ~/.electron-gyp ~/.gradle ~/.gradle-kotlin-dsl ~/.hex ~/.java ~/.kscript ~/.konan ~/.m2 ~/.mix ~/.nix-defexpr ~/.node-gyp ~/.npm ~/.nv ~/.openjfx ~/.parallel ~/.stack ~/.surf ~/.texlive ~/.yarn luametatex-cache
~/.lesshst ~/.yarnrc)
~/.lesshst ~/.rubberband.wisdom.d ~/.yarnrc)
for f in ${_clean_folders[@]}

View File

@ -1,5 +1,6 @@
#!/bin/sh
# Remove recursively safely
case "$1" in ([0-9]) depth=$1; shift;; esac
for f in "$@"
do
test -w "$f" && elevate="" || elevate=sudo

View File

@ -4,5 +4,5 @@
# with forced [C]olorization and pipe into less
# If first arg is a digit, it displaces the default depth of 3
# Any other arguments (usually pathnames) are passed on to the tree command
case "$1" in [0-9]) depth=$1; shift;; esac
case "$1" in ([0-9]) depth=$1; shift;; esac
tree -a --dirsfirst -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less}