diff --git a/.config/shell/functions b/.config/shell/functions index b1a2f93..c31e808 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -90,12 +90,6 @@ edshell() { test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL } -edbin() { - file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")" - edit "$file" - case "$file" in ($HOME*) yadm add "$file";; esac -} - alias l="ls -l --almost-all --human-readable --group-directories-first --file-type" cd() { test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) && diff --git a/.local/bin/scripts/edbin b/.local/bin/scripts/edbin new file mode 100755 index 0000000..ede8eba --- /dev/null +++ b/.local/bin/scripts/edbin @@ -0,0 +1,3 @@ +#!/bin/sh +file="$(f="$(which $1 2>/dev/null)" && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")" +edit "$file" diff --git a/.local/bin/scripts/st-diff b/.local/bin/scripts/st-diff index d6f5fec..e14e0aa 100755 --- a/.local/bin/scripts/st-diff +++ b/.local/bin/scripts/st-diff @@ -1,19 +1,24 @@ #!/bin/sh stats() { - stat --format '%n %A size %sB, birth: %.10w mod %.10y' "$@" + stat --format '%.10y %n %sB - birth %.10w' "$@" } +test "$1" = "-q" && quick=-q && shift if test "$#" -gt 0 then orig="$(st-unarchive "$1")" - ( stats "$orig" "$1"; dif "$orig" "$@" ) | - less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen - test "$?" -eq "2" && exit 1 - echo "y|r to restore, n|d to delete, m to merge" - read reply - case "$reply" in - (y|r) st-restore "$1";; - (n|d) rm -v "$1";; - (m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";; - esac - else find -name '*sync-conflict*' -exec st-diff '{}' \; + if test -n "$quick" + then stats "$orig" "$1" + else + ( stats "$orig" "$1"; dif "$orig" "$@" ) | + less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen + test "$?" -eq "2" && exit 1 + echo "y|r to restore, n|d to delete, m to merge" + read reply + case "$reply" in + (y|r) st-restore "$1";; + (n|d) rm -v "$1";; + (m) touch /tmp/empty && git merge-file "$orig" /tmp/empty "$1" && nvim "$orig" && rm "$1";; + esac + fi + else find -name '*sync-conflict*' -exec st-diff $quick '{}' \; fi diff --git a/.local/bin/scripts/tl b/.local/bin/scripts/tl index 44c546d..b504031 100755 --- a/.local/bin/scripts/tl +++ b/.local/bin/scripts/tl @@ -1,3 +1,3 @@ #!/bin/sh case "$1" in [0-9]) depth=$1; shift;; esac -tree -a -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less} +tree -a --dirsfirst -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less}