Add bash.d. #7
28
.bash.d/.bash_aliases
Normal file
28
.bash.d/.bash_aliases
Normal 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
|
||||||
|
|
||||||
@@ -1,46 +1,13 @@
|
|||||||
# Source ble.sh if installed.
|
# Used in setup script and dockerfile.
|
||||||
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
|
|
||||||
|
|
||||||
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
|
if [ -f /.dockerenv ]; then
|
||||||
export DOT_PACKAGES='git stow vim tmux ranger clang wget curl golang-go'
|
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
|
else
|
||||||
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go gawk'
|
export DOT_PACKAGES='git stow vim vim-gtk3 xsel xclip tmux ranger clang yakuake wget curl golang-go gawk'
|
||||||
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
|
fi
|
||||||
|
|
||||||
# $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 &
|
|
||||||
}
|
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
# 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 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 EDITOR="vim"
|
||||||
export VISUAL="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 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"
|
||||||
@@ -50,17 +17,6 @@ export DOTNET_ROOT=$HOME/.dotnet
|
|||||||
# Example path for autocompletion using libclang-9-dev package, obtained by the following command
|
# 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)"
|
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
|
# Set the default terminal to use konsole, with kapper profile
|
||||||
# + Execute tmux on start
|
# + Execute tmux on start
|
||||||
if [ -e ~/.local/share/konsole/kapper.profile ]; then
|
if [ -e ~/.local/share/konsole/kapper.profile ]; then
|
||||||
@@ -105,15 +61,6 @@ export LESS='--mouse --wheel-lines 2'
|
|||||||
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
|
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
|
||||||
export LESS="$LESS -R -w -#2"
|
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.
|
# For shared systems where history is not desired.
|
||||||
# ln -sf /dev/null ~/.bash_history
|
# ln -sf /dev/null ~/.bash_history
|
||||||
# HISTFILE=/dev/null
|
# HISTFILE=/dev/null
|
||||||
8
.bash.d/.bash_functions
Normal file
8
.bash.d/.bash_functions
Normal 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
15
.bash.d/.bash_sources
Normal 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
11
.bashrc
@@ -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
|
# You may want to put all your additions into a separate file like
|
||||||
# ~/.bash_aliases, instead of adding them here directly.
|
# ~/.bash_aliases, instead of adding them here directly.
|
||||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||||
|
|
||||||
if [ -f ~/.bash_aliases ]; then
|
if [ -f ~/.bash_aliases ]; then
|
||||||
. ~/.bash_aliases
|
. ~/.bash_aliases
|
||||||
fi
|
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
|
# enable programmable completion features (you don't need to enable
|
||||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||||
# sources /etc/bash.bashrc).
|
# sources /etc/bash.bashrc).
|
||||||
|
|||||||
6
setup.sh
6
setup.sh
@@ -16,10 +16,10 @@ fi
|
|||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# Use alias for installing packages so we don't maintain several dependency lists.
|
# Use alias for installing packages so we don't maintain several dependency lists.
|
||||||
if ! [[ -f .bash_aliases ]]; then
|
if ! [[ -f .bash.d/.bash_exports ]]; then
|
||||||
fatal "Failed to locate .bash_aliases in path: $(pwd)" 3
|
fatal "Failed to locate .bash.d/.bash_exports in path: $(pwd)" 3
|
||||||
fi
|
fi
|
||||||
. .bash_aliases
|
. .bash.d/.bash_exports
|
||||||
|
|
||||||
if [[ -z ${DOT_PACKAGES:-} ]]; then
|
if [[ -z ${DOT_PACKAGES:-} ]]; then
|
||||||
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash_aliases" 4
|
fatal "DOT_PACKAGES variable not found after sourcing $(pwd)/.bash_aliases" 4
|
||||||
|
|||||||
Reference in New Issue
Block a user