dotfiles/bashrc

84 lines
2.1 KiB
Bash

source /etc/profile 2>/dev/null
source /etc/profile.d/* 2>/dev/null
# Change prompt if root
if [ $UID -eq 0 ] ; then
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
else
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
fi
# Shorten long usernames
if [ $(whoami | wc -c) -gt 10 ] ; then
USER="me"
else
USER=$(whoami)
fi
PS1='\[\033[0;32m\]${USER}@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]\n'$PROMPT_SUFFIX
export PATH=$PATH:~/bin:~/local/bin
function tmux_title {
printf '\033]2;%s\033\\' $@
}
#tmux_title $(hostname -s)
# Git prompt
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_FETCH_REMOTE_STATUS=0
GIT_PROMPT_IGNORE_STASH=1
GIT_PROMPT_THEME=Noldorized
source ~/.bash-git-prompt/gitprompt.sh
function prompt_callback {
REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\ .*/\1/' | head -1)
gp_set_window_title "$REPO($GIT_BRANCH)"
}
# LS_COLORS
eval $(dircolors -b $HOME/.dircolors)
# Global Options
export LS_OPTIONS=""
export LESS='-R'
export TERM=xterm-256color
export MC_SKIN=$HOME/.mc/lib/solarized.ini
if [ -e ~/.local/bin/virtualenvwrapper.sh ] ; then
# Python stuff
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh
export WORKON_HOME=/home/nold/.virtualenvs
export PIP_VIRTUALENV_BASE=/home/nold/.virtualenvs
fi
# Aliases
alias ls="ls --color=always --time-style=long-iso -F"
alias dfh="df -hT -t ext4 -t zfs"
alias lsof='lsof 2>/dev/null | grep'
# Git
alias gs="git status"
alias gc="git commit -m"
alias gco="git checkout"
alias gl="git l"
alias ga="git add"
alias gpush="git push"
alias gpull="git pull"
# Docker-Compose
alias dcu="docker-compose up -d --remove-orphans"
alias dcd="docker-compose down"
alias dcp="docker-compose pull"
alias dcb="docker-compose build"
alias dcl="docker-compose logs"
alias dclf="docker-compose logs --tail=50 -f"
# k3s / k8s / helm
alias k="kubectl"
alias kga="kubectl get all --all-namespaces -o wide"
alias kgn="kubectl get nodes -o wide"
alias kgp="kubectl get pods -o wide"
type kubectl &>/dev/null && source <(kubectl completion bash)
type helm &>/dev/null && source <(helm completion bash)