dotfiles/bashrc

87 lines
2.6 KiB
Bash
Raw Normal View History

2020-03-22 20:26:38 -04:00
# History
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=10000
HISTFILESIZE=20000
shopt -s checkwinsize
2017-06-19 00:49:00 -04:00
2020-03-22 20:26:38 -04:00
# PS1
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Generic exports
2020-10-23 13:38:16 -04:00
export EDITOR=vim
export GOPATH=$HOME/go
export PATH=$HOME/go/bin:$PATH
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/.local/share/google-cloud-sdk/bin:$PATH
2021-01-25 14:54:01 -05:00
export PATH=$HOME/.local/share/alacritty/target/release:$PATH
2020-10-23 13:38:16 -04:00
export PATH=/usr/NX/bin:$PATH
2021-07-21 14:00:12 -04:00
export TERM=xterm-256color
2017-11-18 10:07:28 -05:00
2020-10-23 13:38:16 -04:00
# Bash completion
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# GPG/SSH
## Void: Install pcsclite, pcsc-ccid, gnupg2-scdaemon
2020-03-22 20:26:38 -04:00
## Debian: Install pcscd scdaemon
2019-08-31 12:27:54 -04:00
## Yubico openpgp: https://support.yubico.com/support/solutions/articles/15000006420-using-your-yubikey-with-openpgp
2019-12-05 13:01:55 -05:00
# Run if ALL variables are not set
if [ -z "$SSH_CONNECTION" ] && [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
2020-03-22 20:26:38 -04:00
# Check for macOS pkcs key
2019-11-26 14:18:41 -05:00
if [[ "$OSTYPE" == 'darwin'* ]]; then
eval `ssh-agent`
ssh-add -t 48h -s $OPENSC_LIBS/opensc-pkcs11.so
fi
2020-03-22 20:26:38 -04:00
# Run if not macOS or if macOS failed to load pkcs11 key
2019-12-05 12:18:35 -05:00
if [[ "$OSTYPE" != 'darwin'* || ("$?" != '0' && "$OSTYPE" == 'darwin'*) ]]; then
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
2019-11-26 14:18:41 -05:00
fi
fi
2020-03-22 20:26:38 -04:00
# OS specific settings
## macOS: do this to prevent incorrect path ordering in tmux:
## https://apple.stackexchange.com/questions/248813/tmux-always-modify-my-zsh-path
2019-11-26 14:18:41 -05:00
if [[ "$OSTYPE" == 'darwin'* ]]; then
export CLICOLOR=YES
2020-02-13 13:56:03 -05:00
export GEM_HOME=/Users/paul.walko/.gem
2019-11-26 14:18:41 -05:00
export OPENSC_LIBS=/usr/local/lib
2020-02-13 13:56:03 -05:00
if [[ -z $TMUX ]]; then
export PATH=$GEM_HOME/bin:$PATH
export PATH=$HOME/.linkerd2/bin:$PATH
2020-10-23 13:41:20 -04:00
export PATH=$HOME/.rvm/bin:$PATH
2020-02-13 13:56:03 -05:00
export PATH=/usr/local/opt/python/libexec/bin:$PATH
export PATH=/usr/local/opt/ncurses/bin:$PATH
fi
2019-11-26 14:18:41 -05:00
elif [[ "$OSTYPE" == 'linux-gnu' ]]; then
2020-03-22 20:26:38 -04:00
alias ls="ls --color=auto"
fi
2019-03-17 12:31:13 -04:00
# VIM
## Reduce delay swithing between normal & insert mode
export KEYTIMEOUT=1
2020-10-23 13:38:16 -04:00
2021-07-21 14:00:12 -04:00
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# qr codes
alias qr='qrencode -t ansiutf8'
# jwt
function jwtd() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
# rbenv
eval "$(rbenv init -)"