Update dotfiles/.bashrc

This commit is contained in:
Brian Zalewski 2022-10-28 03:14:14 +00:00
parent c9ccb1ef52
commit c7b9b72c12

View file

@ -1,3 +1,6 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC1091
### Fig ### Fig
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
if [ -f "$HOME/.fig/shell/bashrc.pre.bash" ]; then if [ -f "$HOME/.fig/shell/bashrc.pre.bash" ]; then
@ -33,20 +36,20 @@ alias pacman='pacman --color=auto'
alias ll='ls -la' alias ll='ls -la'
alias la='ls -A' alias la='ls -A'
alias l='ls -F' alias l='ls -F'
command -v lsd > /dev/null && alias ls='lsd --group-dirs first' && \ command -v lsd >/dev/null && alias ls='lsd --group-dirs first' &&
alias tree='lsd --tree' alias tree='lsd --tree'
command -v colorls > /dev/null && alias ls='colorls --sd --gs' && \ command -v colorls >/dev/null && alias ls='colorls --sd --gs' &&
alias tree='colorls --tree' alias tree='colorls --tree'
### CAT & LESS ### CAT & LESS
command -v bat > /dev/null && \ command -v bat >/dev/null &&
alias bat='bat --theme=ansi' && \ alias bat='bat --theme=ansi' &&
alias cat='bat --pager=never' && \ alias cat='bat --pager=never' &&
alias less='bat' alias less='bat'
# in debian the command is batcat # in debian the command is batcat
command -v batcat > /dev/null && \ command -v batcat >/dev/null &&
alias batcat='batcat --theme=ansi' && \ alias batcat='batcat --theme=ansi' &&
alias cat='batcat --pager=never' && \ alias cat='batcat --pager=never' &&
alias less='batcat' alias less='batcat'
### TOP ### TOP
@ -147,7 +150,7 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
esac esac
# https://github.com/trapd00r/LS_COLORS # https://github.com/trapd00r/LS_COLORS
command -v gdircolors >/dev/null 2>&1 || alias gdircolors="dircolors" command -v gdircolors >/dev/null 2>&1 || gdircolors() { dircolors "$@"; }
if type gdircolors &>/dev/null && [ -f "$HOME/.config/dircolors" ]; then if type gdircolors &>/dev/null && [ -f "$HOME/.config/dircolors" ]; then
eval "$(gdircolors -b "$HOME/.config/dircolors")" eval "$(gdircolors -b "$HOME/.config/dircolors")"
fi fi
@ -178,8 +181,8 @@ glog() {
setterm -linewrap off 2>/dev/null setterm -linewrap off 2>/dev/null
git --no-pager log --all --color=always --graph --abbrev-commit --decorate --date-order \ git --no-pager log --all --color=always --graph --abbrev-commit --decorate --date-order \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' "$@" \ --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' "$@" |
| sed -E \ sed -E \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+ /├\1─╮\2/' \ -e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+ /├\1─╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m /\1├─╯\x1b\[m/' \ -e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m /\1├─╯\x1b\[m/' \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+/├\1╮\2/' \ -e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+/├\1╮\2/' \
@ -190,15 +193,15 @@ glog() {
-e 's/(\x1b\[[0-9;]*m)\\/\1╮/g' \ -e 's/(\x1b\[[0-9;]*m)\\/\1╮/g' \
-e 's/(\x1b\[[0-9;]*m)\//\1╯/g' \ -e 's/(\x1b\[[0-9;]*m)\//\1╯/g' \
-e 's/^\*|(\x1b\[m )\*/\1⎬/g' \ -e 's/^\*|(\x1b\[m )\*/\1⎬/g' \
-e 's/(\x1b\[[0-9;]*m)\|/\1│/g' \ -e 's/(\x1b\[[0-9;]*m)\|/\1│/g' |
| command less -r $([ $# -eq 0 ] && echo "+/[^/]HEAD") command less -r "$([ $# -eq 0 ] && echo "+/[^/]HEAD")"
setterm -linewrap on 2>/dev/null setterm -linewrap on 2>/dev/null
} }
find() { find() {
if [ $# = 1 ] if [ $# = 1 ]; then
then # shellcheck disable=SC2145
command find . -iname "*$@*" command find . -iname "*$@*"
else else
command find "$@" command find "$@"
@ -265,7 +268,7 @@ if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
command -v zoxide >/dev/null && eval "$(zoxide init bash)" command -v zoxide >/dev/null && eval "$(zoxide init bash)"
### MOTD ### MOTD
if [ -f "$HOME/.local/motd.sh" ] && (([ -n "$SSH_CONNECTION" ] && [ "$SHLVL" -eq 1 ] && [[ $- == *i* ]]) || type qubes-vmexec &> /dev/null || type qubes-dom0-update &> /dev/null); then if [ -f "$HOME/.local/motd.sh" ] && { [ -n "$SSH_CONNECTION" ] && [ "$SHLVL" -eq 1 ] && [[ $- == *i* ]]; } || type qubes-vmexec &>/dev/null || type qubes-dom0-update &>/dev/null; then
if [ -z "$MOTD" ] || [ "$MOTD" -ne 0 ]; then if [ -z "$MOTD" ] || [ "$MOTD" -ne 0 ]; then
. "$HOME/.local/motd.sh" . "$HOME/.local/motd.sh"