config/shell: update aliases

This commit is contained in:
xerus2000 2020-12-10 17:34:56 +01:00
parent 1dd3f3d4e7
commit 5638127ff7
3 changed files with 15 additions and 4 deletions

View File

@ -104,6 +104,7 @@
rh = reset HEAD~ rh = reset HEAD~
rs = reset --keep rs = reset --keep
ru = reset --keep @{upstream} ru = reset --keep @{upstream}
rg = rmgonebranches
unstage = reset HEAD -- unstage = reset HEAD --
gcr = !git gc && git repack -a -d gcr = !git gc && git repack -a -d

View File

@ -106,7 +106,12 @@ alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
alias lar='last | tac' alias lar='last | tac'
tr() { tree -a -L 2 --du -h -C "$@" | ${PAGER:-less} } 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 sqli='rlwrap sqlite3 -column -header -cmd .tables'
alias loc='noglob locate --basename' alias loc='noglob locate --basename'
alias uloc='noglob sudo updatedb && locate --basename' alias uloc='noglob sudo updatedb && locate --basename'

View File

@ -1,11 +1,16 @@
#!/bin/sh #!/bin/sh
# Show type & contents of given files or PWD # Show type & contents of given files or PWD
# gets the last arg or current dir
for last; do true; done for last; do true; done
last=${last:-.} 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 case "$(file --dereference --mime "$last")" in
*inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";; *inode/directory*) ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --almost-all "$@";;
*binary) ;; *binary) ;;
*) $(test -f "$last" -a ! -r "$last") bat --style header "$@";; *) $(test -f "$last" -a ! -r "$last") bat --style header "$@";;
esac esac
stat -c 'Permissions: %A, Created: %.10w, Modified %.10y, Size: %s' "$last"