# Navigation alias lg="lazygit" alias ls="exa --long --header --git --group" alias cat="bat --theme=\"Visual Studio Dark+\"" alias tree="exa --tree" alias la="ls -lhA" alias calc="qalc" alias dedsstore="find . -name \".DS_Store\" -delete" alias c="clear" # Difftastic Config export DFT_TAB_WIDTH=4 export DFT_BACKGROUND=light # History HISTSIZE=50000 HISTFILESIZE=50000 HISTCONTROL=ignoreboth:erasedups HISTIGNORE="ls:ll:cd:pwd:bg:fg:history" if [ "$BASH" != "" ]; then # enable bash completion in interactive shells if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi fi if [[ "${OSTYPE}" == "linux-gnu"* ]]; then # History shopt -s histappend # append and reload the history after each command PROMPT_COMMAND="history -a; history -n" if [ -z "$SSH_AUTH_SOCK" ]; then # Check for a currently running instance of the agent RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`" if [ "$RUNNING_AGENT" = "0" ]; then # Launch a new instance of the agent ssh-agent -s &> $HOME/.ssh/ssh-agent sed -i '/^echo Agent pid.*/d' $HOME/.ssh/ssh-agent fi eval `\cat $HOME/.ssh/ssh-agent` for key in $(find "${HOME}/.ssh" -type f -name "*.pub"); do # Don't add if a key with this fingerprint is already in the agent. fp="$(ssh-keygen -lf "${key%.*}" | awk '{print $2}')" ssh-add -l |grep -q "${fp}" || ssh-add -q "${key%.*}" done fi # bind -x '"\C-r"':reset fi # Applications alias tmux="tmux -2" alias grep="grep --color=auto" # Fix gpg signing # https://github.com/keybase/keybase-issues/issues/2798 export GPG_TTY=$(tty) # Golang export PATH=$PATH:/usr/local/go/bin:${HOME}/go/bin export TERM="xterm-256color" export EDITOR=$(which vim) # Adding applications to path if [[ -d ${HOME}/.dotfiles/bin/linux ]]; then export PATH=$PATH:${HOME}/.dotfiles/bin/linux fi if [[ -d ${HOME}/bin ]]; then export PATH=$PATH:${HOME}/bin fi # fzf # TODO: Why are these files in so many different places? if [ -f ~/.fzf.bash ]; then source ~/.fzf.bash fi if [ -f /usr/share/bash-completion/completions/fzf ]; then source /usr/share/bash-completion/completions/fzf fi if [ -f /usr/share/doc/fzf/examples/key-bindings.bash ]; then source /usr/share/doc/fzf/examples/key-bindings.bash fi if [ -f /usr/share/doc/fzf/examples/completion.bash ]; then source /usr/share/doc/fzf/examples/completion.bash fi # Add a local un-tracked bash-rc if present if [[ -f ${HOME}/.bashrc_local ]]; then source ${HOME}/.bashrc_local fi # Git _git_safedel() { if [[ "${COMP_LINE}" =~ ^git\ safedel.*$ ]]; then __gitcomp_nl "$(__git_heads)" else __git_main fi } _git_top() { if [[ "${COMP_LINE}" =~ ^git\ top.*$ ]]; then __gitcomp_nl "$(__git_heads)" else __git_main fi } function up() { num=1 if [ $# -gt 0 ]; then num=$1 fi cd $(printf '../%.0s' $(seq 1 $num)) } # Add color shortcuts if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then c_reset=`tput sgr0` c_user=`tput setaf 2; tput bold` c_path=`tput setaf 4; tput bold` c_git_clean=`tput setaf 2` c_git_dirty=`tput setaf 1` else c_reset= c_user= c_path= c_git_cleanclean= c_git_dirty= fi prev_status_prompt () { status=$? if [ $status -ne 0 ]; then red=`tput setaf 1; tput bold` echo " -- ${red}${status}${c_reset}" fi } git_prompt () { if ! git rev-parse --git-dir > /dev/null 2>&1; then return 0 fi git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') echo " -- $git_branch" } kubectl_context() { if [ ! $(which kubectl) ]; then return 0 fi kubectl cluster-info > /dev/null 2>&1 if [ $? -ne 0 ]; then return 0 fi context=$(kubectl config current-context 2>/dev/null) namespace=$(kubectl config view -o "jsonpath={.contexts[?(@.name==\"$context\")].context.namespace}") cluster=$(kubectl config view -o "jsonpath={.contexts[?(@.name==\"$context\")].context.cluster}") prod_color=`tput setaf 1; tput bold` dev_color=`tput setaf 4; tput bold` if [[ "$EKS_CLUSTER_NAME" = "tgrosinger-he-extrahop-com" ]]; then echo "-- ${dev_color}${cluster}:${namespace}${c_reset}" else echo "-- ${prod_color}${cluster}:${namespace}${c_reset}" fi } if [ "$BASH" != "" ]; then # Prompt PS1="\n╔ \w\$(prev_status_prompt)\$(git_prompt) \$(kubectl_context)\n╚ \h\$ " fi