147 lines
5.1 KiB
Bash
147 lines
5.1 KiB
Bash
###############################################################################
|
|
# Tyler Perkins
|
|
# .bashrc - My shell configuration
|
|
|
|
# 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
|
|
|
|
|
|
###############################################################################
|
|
# Conda Setup #################################################################
|
|
###############################################################################
|
|
# >>> conda initialize >>>
|
|
# !! Contents within this block are managed by 'conda init' !!
|
|
__conda_setup="$('/home/tyler/.conda-install/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
|
if [ $? -eq 0 ]; then
|
|
eval "$__conda_setup"
|
|
else
|
|
if [ -f "/home/tyler/.conda-install/etc/profile.d/conda.sh" ]; then
|
|
. "/home/tyler/.conda-install/etc/profile.d/conda.sh"
|
|
else
|
|
export PATH="/home/tyler/.conda-install/bin:$PATH"
|
|
fi
|
|
fi
|
|
unset __conda_setup
|
|
# <<< conda initialize <<<
|
|
|
|
###############################################################################
|
|
# Export common environment ###################################################
|
|
###############################################################################
|
|
|
|
# Set a huge history file
|
|
HISTSIZE=20000
|
|
HISTFILESIZE=30000
|
|
|
|
# add .cargo/bin to path
|
|
export PATH="/home/tyler/.cargo/bin:$PATH"
|
|
export PATH="/home/tyler/.local/bin:$PATH"
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
# use vim as editor
|
|
export EDITOR="/usr/bin/nvim"
|
|
|
|
# pyenv
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
export PATH="$PYENV_ROOT/versions/bin/3.8.12/bin:$PATH"
|
|
|
|
# proton work directory set as enviroment var
|
|
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
|
|
|
|
# Kubernetes (kubectl) configuration file
|
|
export KUBECONFIG=~/.kube/config
|
|
|
|
# Gpg keep key session to this TTY
|
|
export GPG_TTY=$(tty)
|
|
|
|
###############################################################################
|
|
# Convience Aliases ###########################################################
|
|
###############################################################################
|
|
|
|
# alias set
|
|
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"
|
|
alias vim="nvim"
|
|
|
|
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"
|
|
alias new-motd="vim $HOME/.desktop/alarm/motd.txt"
|
|
|
|
alias disable-alarm=". $HOME/.desktop/alarm/disable-alarm.sh"
|
|
|
|
which doas > /dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
alias sudo="doas"
|
|
fi
|
|
|
|
###############################################################################
|
|
# Misc Configurations #########################################################
|
|
###############################################################################
|
|
|
|
# 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
|
|
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
|
|
|
|
# Custom command autocompletions
|
|
PROG=tea source "$HOME/.config/tea/autocomplete.sh"
|
|
PROG=pass source "$HOME/.local/bin/pass-completion.sh"
|
|
|
|
# Store history after every command
|
|
shopt -s histappend
|
|
PROMPT_COMMAND="history -a; history -c; history -r;$PROMPT_COMMAND"
|
|
|
|
###############################################################################
|
|
# Shell welcome prompt ########################################################
|
|
###############################################################################
|
|
|
|
#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) "
|