6 Commits

Author SHA1 Message Date
e7c4fe36bc Ignore blesh installations. 2026-02-21 08:22:47 -05:00
dabfa780df Add bash.d. 2026-02-21 08:08:06 -05:00
288dc28e07 Disable inputrc for now.
Keeping it around in case a non-blesh option is wanted in the future.
2026-02-21 06:51:54 -05:00
c7f6c0b791 Add Qt assistant bash helper. 2026-02-21 06:51:34 -05:00
f1930f166d Update clang_complete. 2026-02-21 06:46:42 -05:00
e85e4bb65d Add blerc. (#6) 2026-02-15 03:40:40 +00:00
11 changed files with 156 additions and 51 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

View File

@@ -1,34 +1,13 @@
# Source rust things if they exist
if [ -f ~/.cargo/env ]; then
. ~/.cargo/env
fi
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.
# Used in setup script and dockerfile.
if [ -f /.dockerenv ]; then
export DOT_PACKAGES='git stow vim tmux ranger clang wget curl golang-go'
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
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go'
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"
alias ,assistant="nohup $HOME/Qt/6.9.0/gcc_64/bin/assistant > /dev/null 2>&1 &"
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'
# 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$//'\'')"'
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"
@@ -38,17 +17,6 @@ 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)"
# Source a top-secret alias file
if [ -e ~/.bash_secrets ]; then
. ~/.bash_secrets
fi
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
# Set the default terminal to use konsole, with kapper profile
# + Execute tmux on start
if [ -e ~/.local/share/konsole/kapper.profile ]; then
@@ -93,15 +61,6 @@ export LESS='--mouse --wheel-lines 2'
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
export LESS="$LESS -R -w -#2"
if ! [ command -v conda &>/dev/null ] && [ -e ~/Code/Clones/mambaforge/bin/conda ] && ! grep -e conda ~/.bashrc &>/dev/null; then
if ! (~/Code/Clones/mambaforge/bin/conda init | awk -F "==>" '{print $1}'); then
echo "[dot] ERROR: Failed to initialize Conda."
fi
echo "[dot] WARN: Ran \`conda init\`; Conda was installed but not initialized"
source ~/.bashrc
fi
# For shared systems where history is not desired.
# ln -sf /dev/null ~/.bash_history
# HISTFILE=/dev/null

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

@@ -0,0 +1,8 @@
# $1: Version
# $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 [ -e ~/.bash_secrets ]; then
. ~/.bash_secrets
fi

11
.bashrc
View File

@@ -100,11 +100,20 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Source all files in ~/.bash.d, if it exists.
# This can contain .bash_aliases, or other configs to append to your shell.
if [ -d ~/.bash.d ]; then
for f in ~/.bash.d/.*; do
if [ -f $f ]; then
. $f
fi
done
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).

54
.blerc Normal file
View File

@@ -0,0 +1,54 @@
# Insert date-time string within a bash prompt using `\dt<SP>`
function blerc/define-sabbrev-dt {
ble-sabbrev -m '\dt'='ble/util/assign COMPREPLY "date +%F_%H-%M-%S"'
}
blehook/eval-after-load complete blerc/define-sabbrev-dt
# Insert the time within a bash prompt using `\time<SP>`
function blerc/define-sabbrev-time {
ble-sabbrev -m '\time'='ble/util/assign COMPREPLY "date +%H-%M-%S"'
}
blehook/eval-after-load complete blerc/define-sabbrev-time
# Insert the date within a bash prompt using `\date<SP>`
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r1-insert-date-through-sabbrev-date
function blerc/define-sabbrev-date {
ble-sabbrev -m '\date'='ble/util/assign COMPREPLY "date +%F"'
}
blehook/eval-after-load complete blerc/define-sabbrev-date
# Interactive git branch selection with `\branch<SP>`
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r2-insert-git-branch-name-from-menu-through-sabbrev-branch
function blerc/define-sabbrev-branch {
function blerc/sabbrev-git-branch {
ble/util/assign-array COMPREPLY "git branch | sed 's/^\*\{0,1\}[[:blank:]]*//'" 2>/dev/null
}
ble-sabbrev -m '\branch'=blerc/sabbrev-git-branch
}
blehook/eval-after-load complete blerc/define-sabbrev-branch
# Interactive git commit selection with `\commit<SP>`
# https://github.com/akinomyoga/ble.sh/wiki/Recipes#r3-insert-git-commit-id-from-menu-through-sabbrev-commit
function blerc/define-sabbrev-commit {
ble/color/defface blerc_git_commit_id fg=63
ble/complete/action#inherit-from blerc_git_commit_id word
function ble/complete/action:blerc_git_commit_id/init-menu-item {
local ret
ble/color/face2g blerc_git_commit_id; g=$ret
}
function blerc/sabbrev-git-commit {
bleopt sabbrev_menu_style=desc-raw
bleopt sabbrev_menu_opts=enter_menu
local format=$'%h \e[1;32m(%ar)\e[m %s - \e[4m%an\e[m\e[1;33m%d\e[m'
local arr; ble/util/assign-array arr 'git log --pretty=format:"$format"' &>/dev/null
local line hash subject
for line in "${arr[@]}"; do
builtin read hash subject <<< "$line"
ble/complete/cand/yield blerc_git_commit_id "$hash" "$subject"
done
}
ble-sabbrev -m '\commit'='blerc/sabbrev-git-commit'
}
blehook/eval-after-load complete blerc/define-sabbrev-commit

View File

@@ -49,4 +49,4 @@ ShowOnAllDesktops=true
ShowSystrayIcon=true
ShowTabBar=true
ShowTitleBar=true
ToggleToFocus=false
ToggleToFocus=false

3
.gitignore vendored
View File

@@ -13,6 +13,9 @@
.config/Code/rapid_render.json
.config/Code/Network*
**/.config/.brightness
.local/share/fonts/.uuid
.local/share/blesh
.local/share/doc
# Byte-compiled / optimized / DLL files
*__pycache__/

View File

@@ -1,2 +1,4 @@
"\e[A": history-search-backward
"\e[B": history-search-forward
# This will automatically trigger reverse search when using up / down in bash
# However it doesn't feel natural with ble.sh, so it's commented out for now.
#"\e[A": history-search-backward
#"\e[B": history-search-forward

View File

@@ -1,6 +1,33 @@
#!/usr/bin/env bash
git submodule update --init
set -Eeuo pipefail
# $1: Error message
# $2: Error code
function fatal() {
local msg=${1:-"Unspecified error"}
echo "[Error:$LINENO] Could not install dotfiles: $msg"
exit ${2:-1}
}
trap 'fatal "Trapped an unknown error" $?' ERR
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
fatal "Run setup.sh from the root directory of the dotfiles repository." 2
fi
git submodule update --init --recursive
# Use alias for installing packages so we don't maintain several dependency lists.
. .bash_aliases
,init
if ! [[ -f .bash.d/.bash_exports ]]; then
fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3
fi
. .bash.d/.bash_exports
if [[ -z ${DOT_PACKAGES:-} ]]; then
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash_aliases" 4
fi
sudo apt update -y && sudo apt install -y $DOT_PACKAGES
go install github.com/arl/gitmux@latest
# Install bash line editor for auto completion.
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=$(pwd)/.local
rm -rf ble.sh