Add bash.d. (#7)

This commit was merged in pull request #7.
This commit is contained in:
2026-02-21 15:14:39 +00:00
parent e85e4bb65d
commit 84018dbeec
11 changed files with 133 additions and 97 deletions

28
.bash.d/.bash_aliases Normal file
View File

@@ -0,0 +1,28 @@
alias ,git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"'
# Some aliases don't make sense in the docker image, like shortcuts to fix plasmashell.
if [ -f /.dockerenv ]; then
alias ,update='apt update -y && apt upgrade -y && apt upgrade --fix-broken --fix-missing --auto-remove'
alias ,init='apt update -y && apt install -y $DOT_PACKAGES'
alias ,swap='swapoff -a && swapon -a'
else
alias ,update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
alias ,init='sudo apt update -y && sudo apt install -y $DOT_PACKAGES'
# Clear kscreen cached settings
alias ,kscreen='rm -rf ~/.local/share/kscreen/*'
# Restart plasmashell
alias ,plasmashell='plasmashell --replace &> /dev/null &'
alias ,swap='sudo swapoff -a && sudo swapon -a'
alias ,vbox="ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill"
fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Don't use tmux in vscode to avoid 'failure to resolve shell' errors.
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
if ! pstree -s $$ | grep -wq code; then
exec tmux >/dev/null 2>&1
fi
fi

73
.bash.d/.bash_exports Normal file
View File

@@ -0,0 +1,73 @@
# Used in setup script and dockerfile.
if [ -f /.dockerenv ]; then
export DOT_PACKAGES='git stow vim tmux ranger clang wget curl golang-go'
else
# `vim-gtk3` is required to keep your system copy and paste buffers in sync with vim registers.
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go gawk'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export EDITOR="vim"
export VISUAL="vim"
export LS_COLORS="di=1;34:ln=31;47:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
export PATH=$PATH:/opt/:$HOME/.local/bin/:$HOME/.dotnet:$HOME/go/bin/
export DOTNET_ROOT=$HOME/.dotnet
# Example path for autocompletion using libclang-9-dev package, obtained by the following command
export LIBCLANG="$(command -v clang &>/dev/null && ldconfig -p | sort | grep libclang-[0-9]. | awk -F "> " '{print$2}' | tail -n 1)"
# Set the default terminal to use konsole, with kapper profile
# + Execute tmux on start
if [ -e ~/.local/share/konsole/kapper.profile ]; then
if command -v tmux &>/dev/null; then
export TERMINAL='konsole --profile kapper -e tmux'
else
export TERMINAL='konsole --profile kapper'
fi
fi
# Conditionally enables font glyphs in .vimrc if available
if [ -e ~/.local/share/fonts/sauce-code-pro.otf ]; then
export SAUCE=1
fi
# Less colors for man pages
export PAGER=less
default=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 2)
purple=$(tput setaf 5)
orange=$(tput setaf 9)
# Begin blinking
export LESS_TERMCAP_mb=$red
# Begin bold
export LESS_TERMCAP_md=$orange
# End mode
export LESS_TERMCAP_me=$default
# End standout-mode
export LESS_TERMCAP_se=$default
# Begin standout-mode - info box
export LESS_TERMCAP_so=$purple
# End underline
export LESS_TERMCAP_ue=$default
# Begin underline
export LESS_TERMCAP_us=$green
# Allow mouse wheel movement for less output (manpages, diffs)
export LESS='--mouse --wheel-lines 2'
# Set additional flags for less
# + -R for raw control characters
# + -w to highlight first unread line when jumping N>1 lines down
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
export LESS="$LESS -R -w -#2"
# For shared systems where history is not desired.
# ln -sf /dev/null ~/.bash_history
# HISTFILE=/dev/null
# Avoid duplicates in bash history.
HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it.
shopt -s histappend

8
.bash.d/.bash_functions Normal file
View File

@@ -0,0 +1,8 @@
# $1: Version; defaults to 6.7.3
# $2: Path to Qt; defaults to $HOME/Qt
function assistant {
local version=${1:-6\.7\.3}
local path=${2:-$HOME/Qt}
nohup ${path%/}/$version/gcc_64/bin/assistant > /dev/null 2>&1 &
}

15
.bash.d/.bash_sources Normal file
View File

@@ -0,0 +1,15 @@
# Source ble.sh if installed.
if [ -f ~/.local/share/blesh/ble.sh ]; then
source -- ~/.local/share/blesh/ble.sh
fi
# Source rust things if they exist
if [ -f ~/.cargo/env ]; then
. ~/.cargo/env
fi
# Source a top-secret alias file
if [ -f ~/.bash.d/.bash_secrets ]; then
. ~/.bash.d/.bash_secrets
fi