dotfiles/bashrc

82 lines
1.9 KiB
Bash
Raw Normal View History

source /etc/profile 2>/dev/null
source /etc/profile.d/* 2>/dev/null
2017-11-03 08:46:24 +00:00
# Change prompt if root
2017-11-03 07:49:05 +00:00
if [ $UID -eq 0 ] ; then
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
else
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
fi
2017-11-03 08:46:24 +00:00
# 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
2017-11-03 07:09:33 +00:00
function tmux_title {
printf '\033]2;%s\033\\' $@
}
2019-08-02 05:41:01 +00:00
#tmux_title $(hostname -s)
2017-11-03 07:09:33 +00:00
if [ -f ~/git/homedir-config/hosts/$(hostname -s)/bashrc ] ; then
source ~/git/homedir-config/hosts/$(hostname -s)/bashrc
2021-04-19 10:08:05 +00:00
else
source ~/git/homedir-config/hosts/any/bashrc
2021-04-19 10:08:05 +00:00
fi
if type nvim &>/dev/null ; then
alias vim=nvim
2021-04-19 10:08:05 +00:00
fi
2017-11-03 07:09:33 +00:00
# LS_COLORS
eval $(dircolors -b $HOME/.dircolors)
# Global Options
export LS_OPTIONS=""
export LESS='-R'
2017-11-03 07:45:03 +00:00
export TERM=xterm-256color
2020-03-13 17:00:12 +00:00
export MC_SKIN=$HOME/.mc/lib/solarized.ini
2017-11-03 07:09:33 +00:00
#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 {
2022-04-02 13:50:26 +00:00
cat $@ | python3 -c 'import sys, yaml, json; print(yaml.dump(json.loads(sys.stdin.read())))'
}
2017-11-03 07:09:33 +00:00
# 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
2017-11-03 07:09:33 +00:00
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"
2022-02-14 20:37:02 +00:00
alias gcap="git commit --amend --no-edit && git push -f"
2020-03-13 17:00:12 +00:00
# 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"
2021-04-19 10:08:05 +00:00
# Completions for various tools...
2022-02-14 20:37:02 +00:00
for bin in kubectl helm clusterctl talosctl flux ; do
2021-04-19 10:08:05 +00:00
type $bin &>/dev/null && source <($bin completion bash)
done