Use tab indents and undo last speedup

This commit is contained in:
Anthony Rose 2021-05-02 22:17:58 +01:00
parent 8b9213fde7
commit bb1e7680fc

View file

@ -1,38 +1,40 @@
#!/bin/bash #!/bin/bash
export ACP_BASHRC=1 export ACP_BASHRC=1
if [ -f /etc/bashrc ]
then
. /etc/bashrc
fi
if [ -f /usr/share/bash-completion/bash_completion ] if [ -f /usr/share/bash-completion/bash_completion ]
then then
true . /usr/share/bash-completion/bash_completion
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ] elif [ -f /etc/bash_completion ]
then then
true . /etc/bash_completion
. /etc/bash_completion
fi fi
if [ -f /usr/share/bash-completion/completions/quilt ] if [ -f /usr/share/bash-completion/completions/quilt ]
then then
true . /usr/share/bash-completion/completions/quilt
. /usr/share/bash-completion/completions/quilt complete -F _quilt_completion -o filenames dquilt
complete -F _quilt_completion -o filenames dquilt
fi fi
_acp_add_path () { _acp_add_path () {
if ! [[ "$PATH" =~ "$1:" ]] && test -d "$1" if ! [[ "$PATH" =~ "$1:" ]] && test -d "$1"
then then
PATH="$1:$PATH" PATH="$1:$PATH"
fi fi
export PATH export PATH
} }
for dir in "$HOME/bin" \ for dir in "$HOME/bin" \
"$HOME/.cargo/bin" \ "$HOME/.cargo/bin" \
"$HOME/opt/centos-git-common" \ "$HOME/opt/centos-git-common" \
/usr/local/sbin \ /usr/local/sbin \
/usr/local/bin /usr/local/bin
do do
_acp_add_path "$dir" _acp_add_path "$dir"
done done
umask 0022 umask 0022
@ -55,7 +57,7 @@ export PYTHONWARNINGS=ignore::UserWarning
if test -x /usr/bin/tty if test -x /usr/bin/tty
then then
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
fi fi
shopt -s histappend shopt -s histappend
@ -68,10 +70,10 @@ bind 'set completion-ignore-case on'
if test $(id -u) -eq 0 if test $(id -u) -eq 0
then then
export PS1="\[\033[01;35m\]╭─ \u @ \h ────\n╰─ #\[\033[00m\] " export PS1="\[\033[01;35m\]╭─ \u @ \h ────\n╰─ #\[\033[00m\] "
else else
export PS1="\[\033[01;35m\]╭─ \u @ \h ────\n╰─ $\[\033[00m\] " export PS1="\[\033[01;35m\]╭─ \u @ \h ────\n╰─ $\[\033[00m\] "
alias dnf="dnf -C" alias dnf="dnf -C"
fi fi
alias 7zencrypt="7z a -t7z -p -mhe" alias 7zencrypt="7z a -t7z -p -mhe"
@ -101,24 +103,24 @@ alias zlu="zypper list-updates"
# Alias vi to vim if it is installed. # Alias vi to vim if it is installed.
if [ -x /usr/bin/vim ] if [ -x /usr/bin/vim ]
then then
alias vi=vim alias vi=vim
fi fi
# Set up GOPATH. # Set up GOPATH.
export GOPATH="$HOME/data/go" export GOPATH="$HOME/data/go"
if [ -x "$HOME/opt/go/bin/go" ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ] if [ -x "$HOME/opt/go/bin/go" ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ]
then then
if [ ! -d "$GOPATH" ] if [ ! -d "$GOPATH" ]
then then
mkdir -p "$GOPATH/bin" mkdir -p "$GOPATH/bin"
mkdir -p "$GOPATH/pkg" mkdir -p "$GOPATH/pkg"
mkdir -p "$GOPATH/src" mkdir -p "$GOPATH/src"
fi fi
if [ -x "$HOME/opt/go/bin/go" ] if [ -x "$HOME/opt/go/bin/go" ]
then then
export GOROOT="$HOME/opt/go" export GOROOT="$HOME/opt/go"
_acp_add_path "$GOROOT/bin" _acp_add_path "$GOROOT/bin"
fi fi
fi fi
# Useful aliases for Podman and Docker # Useful aliases for Podman and Docker
@ -131,78 +133,78 @@ alias drun="sudo docker run --rm -it"
_snap_xdg_path=/var/lib/snapd/desktop _snap_xdg_path=/var/lib/snapd/desktop
if [ -n "${XDG_DATA_DIRS##*${_snap_xdg_path}}" ] && [ -n "${XDG_DATA_DIRS##*${_snap_xdg_path}:*}" ] if [ -n "${XDG_DATA_DIRS##*${_snap_xdg_path}}" ] && [ -n "${XDG_DATA_DIRS##*${_snap_xdg_path}:*}" ]
then then
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${_snap_xdg_path}" export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${_snap_xdg_path}"
fi fi
unset _snap_xdg_path unset _snap_xdg_path
mkcd () { mkcd () {
if [ $# -ne 1 ] if [ $# -ne 1 ]
then then
echo "mkcd: incorrect arguments (one directory required)." >&2 echo "mkcd: incorrect arguments (one directory required)." >&2
return 1 return 1
else else
mkdir -p "$1" mkdir -p "$1"
cd "$1" cd "$1"
fi fi
} }
termtitle () { termtitle () {
echo -en "\033]0;$1\007" echo -en "\033]0;$1\007"
} }
linapm () { linapm () {
cat /sys/class/power_supply/BAT0/{status,capacity} cat /sys/class/power_supply/BAT0/{status,capacity}
} }
xa () { xa () {
out=$(xrandr --listactivemonitors | awk 'NR!=1{print " "$NF" "}') out=$(xrandr --listactivemonitors | awk 'NR!=1{print " "$NF" "}')
for monitor in "$out" for monitor in "$out"
do do
m=$(echo "$monitor" | sed 's/ //g') m=$(echo "$monitor" | sed 's/ //g')
xrandr --output "$m" --auto xrandr --output "$m" --auto
done done
} }
emacsro () { emacsro () {
emacs "$1" -f view-mode emacs "$1" -f view-mode
} }
tm () { tm () {
if tmux list-session 2>/dev/null 1>/dev/null if tmux list-session 2>/dev/null 1>/dev/null
then then
tmux -2 attach-session tmux -2 attach-session
else else
tmux -2 new-session tmux -2 new-session
fi fi
} }
if [ -x /usr/bin/yum ] && [ ! -x /usr/bin/dnf ] if [ -x /usr/bin/yum ] && [ ! -x /usr/bin/dnf ]
then then
alias dnf=yum alias dnf=yum
fi fi
case "$-" in case "$-" in
*i*) *i*)
# Shell is interactive # Shell is interactive
printf "\033[7m"; uname -sr; printf "\033[0m" printf "\033[7m"; uname -sr; printf "\033[0m"
if [ -r /etc/os-release ] if [ -r /etc/os-release ]
then then
echo " $(. /etc/os-release; echo $NAME $VERSION)" echo " $(. /etc/os-release; echo $NAME $VERSION)"
fi fi
;; ;;
*) *)
;; ;;
esac esac
if [ -S "$SSH_AUTH_SOCK" ] \ if [ -S "$SSH_AUTH_SOCK" ] \
&& [ -r "$HOME/.ssh/id_ed25519" ] \ && [ -r "$HOME/.ssh/id_ed25519" ] \
&& [ -r "$HOME/.ssh/id_ed25519.pub" ] \ && [ -r "$HOME/.ssh/id_ed25519.pub" ] \
&& [ $(ssh-add -l | grep "$(ssh-keygen -l -f "$HOME/.ssh/id_ed25519.pub")" | wc -l) = 0 ] && [ $(ssh-add -l | grep "$(ssh-keygen -l -f "$HOME/.ssh/id_ed25519.pub")" | wc -l) = 0 ]
then then
ssh-add "$HOME/.ssh/id_ed25519" ssh-add "$HOME/.ssh/id_ed25519"
fi fi
if [ -r "$HOME/.bashrc.local" ] if [ -r "$HOME/.bashrc.local" ]
then then
. "$HOME/.bashrc.local" . "$HOME/.bashrc.local"
fi fi