neodot/.bashrc

154 lines
5.4 KiB
Bash
Raw Normal View History

2023-11-30 03:15:08 +00:00
###############################################################################
# Tyler Perkins
2023-12-09 20:19:14 +00:00
# .bashrc - My shell configuration
2023-11-30 03:15:08 +00:00
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
2023-12-09 20:19:14 +00:00
###############################################################################
# Conda Setup #################################################################
###############################################################################
2023-11-30 03:15:08 +00:00
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
2023-12-14 02:30:16 +00:00
__conda_setup="$('/home/tyler/.conda-install/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
2023-11-30 03:15:08 +00:00
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
2023-12-14 02:30:16 +00:00
if [ -f "/home/tyler/.conda-install/etc/profile.d/conda.sh" ]; then
. "/home/tyler/.conda-install/etc/profile.d/conda.sh"
2023-11-30 03:15:08 +00:00
else
2023-12-14 02:30:16 +00:00
export PATH="/home/tyler/.conda-install/bin:$PATH"
2023-11-30 03:15:08 +00:00
fi
fi
unset __conda_setup
# <<< conda initialize <<<
2023-12-09 20:19:14 +00:00
###############################################################################
# Export common environment ###################################################
###############################################################################
2023-11-30 03:15:08 +00:00
# Set a huge history file
HISTSIZE=20000
HISTFILESIZE=30000
2023-12-09 20:19:14 +00:00
# add .cargo/bin to path
2023-11-30 03:15:08 +00:00
export PATH="/home/tyler/.cargo/bin:$PATH"
export PATH="/home/tyler/.local/bin:$PATH"
export _JAVA_AWT_WM_NONREPARENTING=1
2023-12-09 20:19:14 +00:00
# use vim as editor
2024-01-22 01:05:37 +00:00
export EDITOR="/usr/bin/nvim"
2023-11-30 03:15:08 +00:00
2023-12-09 20:19:14 +00:00
# pyenv
2023-11-30 03:15:08 +00:00
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/versions/bin/3.8.12/bin:$PATH"
2023-12-09 20:19:14 +00:00
# proton work directory set as enviroment var
2023-11-30 03:15:08 +00:00
export STEAM_COMPAT_DATA_PATH=~/.proton/
export STEAM_COMPAT_CLIENT_INSTALL_PATH=~/.steam/steam/steamapps/common/Proton\ 6.3/
# Pico programming
export PICO_SDK_PATH=/home/tyler/code/pico/pico-sdk
2023-12-09 20:19:14 +00:00
# Kubernetes (kubectl) configuration file
export KUBECONFIG=~/.kube/config
# Gpg keep key session to this TTY
export GPG_TTY=$(tty)
2023-11-30 03:15:08 +00:00
2023-12-09 20:19:14 +00:00
###############################################################################
# Convience Aliases ###########################################################
###############################################################################
2023-11-30 03:15:08 +00:00
2023-12-09 20:19:14 +00:00
# alias set
2023-11-30 03:15:08 +00:00
alias ls="ls --color"
alias l="ls -al"
alias lt="ls --human-readable --size -S --classify"
alias ..="cd .."
alias sha="shasum -a 256"
alias untar="tar zxvf"
alias sync="sudo emerge --sync && sudo layman -S"
alias upgrade-all="sudo emerge --ask --verbose --update --deep --changed-use @world"
alias myip="curl ipinfo.io/ip"
alias port="netstat -tulanp"
alias ports="netstat -tulanp | less"
alias audio="pulsemixer"
alias email="aerc"
alias weather="curl wttr.in"
alias httpserver="python -m http.server"
alias google="tuxi"
alias clipboard="xclip -selection clipboard"
alias new-wallpaper="feh --bg-fill --randomize ~/.desktop/wallpaper/"
alias gitea="tea"
alias set-motd="vim /home/tyler/.desktop/alarm/motd.txt"
alias ":q!"="exit"
2024-01-22 01:05:37 +00:00
alias vim="nvim"
2023-11-30 03:15:08 +00:00
alias diff="diff --color=auto"
alias grep="grep -i --color=auto"
alias mv="mv -v"
alias arduino=" arduino"
alias logisim-evolution="_JAVA_AWT_WM_NONREPARENTING=1 logisim-evolution"
alias vifm="vifmrun"
alias f="vifm"
2023-12-09 20:19:14 +00:00
alias new-motd="vim $HOME/.desktop/alarm/motd.txt"
2023-11-30 03:15:08 +00:00
2023-12-09 20:19:14 +00:00
alias disable-alarm=". $HOME/.desktop/alarm/disable-alarm.sh"
2023-12-04 14:28:13 +00:00
which doas > /dev/null 2>&1
if [ $? -eq 0 ]; then
alias sudo="doas"
fi
2023-12-09 20:19:14 +00:00
###############################################################################
# Misc Configurations #########################################################
###############################################################################
2023-11-30 03:15:08 +00:00
2023-12-09 20:19:14 +00:00
# Setup sdkman
if [ -f $HOME/.sdkman/bin/sdkman-init.sh ]; then
source $HOME/.sdkman/bin/sdkman-init.sh
fi
# Change shell character based on root/user
2023-12-07 15:39:51 +00:00
if [ "$UID" -eq 0 ]; then
export PS1="\033[1m\e[0;97m[\e[0;32m\u\e[0;97m@\e[0;31m\h \e[0;97m(\D{}) \w]\n# \033[0m"
else
export PS1="\033[1m\e[0;97m[\e[0;32m\u\e[0;97m@\e[0;31m\h \e[0;97m(\D{}) \w]\n$ \033[0m"
fi
2023-12-09 20:19:14 +00:00
# Custom command autocompletions
PROG=tea source "$HOME/.config/tea/autocomplete.sh"
PROG=pass source "$HOME/.local/bin/pass-completion.sh"
which flux > /dev/null 2>&1 && . <(flux completion bash)
2023-12-09 20:19:14 +00:00
# Store history after every command
shopt -s histappend
PROMPT_COMMAND="history -a; history -c; history -r;$PROMPT_COMMAND"
###############################################################################
# Shell welcome prompt ########################################################
###############################################################################
2023-11-30 03:15:08 +00:00
#display colors
_PROMPT_GREEN_='\033[1;32m'
_PROMPT_HEAD_="$_PROMPT_GREEN_"
_PROMPT_VAR_='\033[0;31m'
#display stuff at beggining of the shell
echo -e "${_PROMPT_HEAD_}#########################"
echo -e "${_PROMPT_HEAD_}#Welcome ${_PROMPT_VAR_}$(whoami)"
echo -e "${_PROMPT_HEAD_}#EIp : ${_PROMPT_VAR_}$(ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')"
echo -e "${_PROMPT_HEAD_}#Time: ${_PROMPT_VAR_}$(date +"%T")"
echo -e "${_PROMPT_HEAD_}#${_PROMPT_VAR_}\x1b[3m $(shuf -n 1 ~/.desktop/messages.txt) "
2024-02-06 18:19:41 +00:00
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
2024-03-19 23:44:54 +00:00
[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh
eval "$(atuin init bash)"