From 5638127ff7db56ffd3a2c48cb7bc764dc6f84fdd Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Thu, 10 Dec 2020 17:34:56 +0100 Subject: [PATCH] config/shell: update aliases --- .config/git/config | 3 ++- .config/shell/functions | 7 ++++++- .local/bin/b | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.config/git/config b/.config/git/config index f845967..3e209c6 100644 --- a/.config/git/config +++ b/.config/git/config @@ -104,9 +104,10 @@ rh = reset HEAD~ rs = reset --keep ru = reset --keep @{upstream} + rg = rmgonebranches unstage = reset HEAD -- gcr = !git gc && git repack -a -d - + ready = rebase -i @{push} format-head = !git stash && git-clang-format HEAD~ && git commit -a --amend --no-edit && git stash pop diff --git a/.config/shell/functions b/.config/shell/functions index d805ce2..6a6a17a 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -106,7 +106,12 @@ alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G' alias lar='last | tac' tr() { tree -a -L 2 --du -h -C "$@" | ${PAGER:-less} } -alias xo='xdg-open' +xo() { + while test $# -gt 0; do + xdg-open "$1" + shift + done +} alias sqli='rlwrap sqlite3 -column -header -cmd .tables' alias loc='noglob locate --basename' alias uloc='noglob sudo updatedb && locate --basename' diff --git a/.local/bin/b b/.local/bin/b index 89f2e4a..3a2eb02 100755 --- a/.local/bin/b +++ b/.local/bin/b @@ -1,11 +1,16 @@ #!/bin/sh # Show type & contents of given files or PWD + +# gets the last arg or current dir for last; do true; done last=${last:-.} -file "$last" | grep -v --color=never directory -stat -c 'Permissions: %A, Created: %.10w, Modified %.10y, Size: %s' "$last" + +file "$last" | grep -v --color=never 'directory$' +test -e "$last" || exit 1 + case "$(file --dereference --mime "$last")" in *inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";; *binary) ;; *) $(test -f "$last" -a ! -r "$last") bat --style header "$@";; esac +stat -c 'Permissions: %A, Created: %.10w, Modified %.10y, Size: %s' "$last"