dotfiles/bashrc
2022-04-02 15:50:26 +02:00

82 lines
1.9 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
export PATH=$PATH:~/bin:~/local/bin:~/local/usr/bin
function tmux_title {
printf '\033]2;%s\033\\' $@
}
#tmux_title $(hostname -s)
if [ -f ~/git/homedir-config/hosts/$(hostname -s)/bashrc ] ; then
source ~/git/homedir-config/hosts/$(hostname -s)/bashrc
else
source ~/git/homedir-config/hosts/any/bashrc
fi
if type nvim &>/dev/null ; then
alias vim=nvim
fi
# 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
# Functions
function json2yaml {
cat $@ | python3 -c 'import sys, yaml, json; print(yaml.dump(json.loads(sys.stdin.read())))'
}
# Aliases
alias ls="ls --color=always --time-style=long-iso -F"
alias dfh="df -hT -t ext4 -t zfs -t xfs"
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"
alias gcap="git commit --amend --no-edit && git push -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"
# Completions for various tools...
for bin in kubectl helm clusterctl talosctl flux ; do
type $bin &>/dev/null && source <($bin completion bash)
done