dotfiles/zshrc
2022-01-03 10:24:30 -05:00

262 lines
5.0 KiB
Bash

[[ "${ZSH_DEBUG}" ]] && set -o xtrace
ZSH=$HOME/.oh-my-zsh
ZSH_THEME=dracula
CASE_SENSITIVE="true"
# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
export UPDATE_ZSH_DAYS=3
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting
# for completion
COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
path=(
$HOME/.cargo/bin
$HOME/.rbenv/bin
$HOME/.rbenv/shims
$HOME/.phpenv/bin
$HOME/.pyenv/bin
$HOME/.pyenv/shims
$HOME/.yarn/bin
$HOME/.pulumi/bin
$HOME/bin
$HOME/go/bin
$HOME/.local/bin
$HOME/perl5/bin
$HOME/Library/Python/3.8/bin
/usr/local/opt/python@3.8/bin
/usr/local/sbin
/usr/local/bin
/usr/bin/vendor_perl
/usr/sbin
/usr/bin
/sbin
/bin
/snap/bin
/usr/games
/usr/local/games
/usr/local/texlive/2018/bin/x86_64-darwin
)
plugins=(
archlinux
aws
bundler
cargo
command-not-found
cp
direnv
docker
gem
git
golang
helm
heroku
httpie
kubectl
mercurial
minikube
nmap
node
nvm
pip
postgres
pyenv
python
rails
rake-fast
rbenv
redis-cli
rsync
ruby
rust
rustup
terraform
tmux
vagrant
vault
vi-mode
yarn
)
if [[ -d ~/.oh-my-zsh/plugins/just/ ]]; then
plugins+=just
fi
fpath=(/usr/local/share/zsh/site-functions $fpath)
source $ZSH/oh-my-zsh.sh
unalias gb &>/dev/null
export EDITOR=vim
export PYENV_ROOT="${HOME}/.pyenv"
export SDKMAN_DIR="${HOME}/.sdkman"
export VISUAL=vim
# The completion for aws is not compatible with $fpath :scream_cat:
if [[ -f /usr/local/share/zsh/site-functions/_aws ]] ; then
source /usr/local/share/zsh/site-functions/_aws
fi
if [[ -f ~/.local/bin/aws_zsh_completer.sh ]]; then
source ~/.local/bin/aws_zsh_completer.sh
fi
if command -v xdg-open &>/dev/null; then
alias open=xdg-open
fi
if command -v setxkbmap &>/dev/null; then
alias kbus='setxkbmap -layout us'
alias kbdv='setxkbmap -layout dvorak'
fi
if R --version &>/dev/null; then
alias R='R --no-save --no-restore-data'
fi
if command -v ssh-add &>/dev/null; then
alias ssh-add='ssh-add -t 1h'
fi
if psql --version &>/dev/null; then
alias pgme='psql -d postgres://me@jool.meatballhat.com:15744/me'
fi
unsetopt correct_all
bindkey '^R' history-incremental-search-backward
if which pyenv >/dev/null; then
eval "$(pyenv init - 2>/dev/null)"
fi
if which phpenv >/dev/null; then
eval "$(phpenv init - 2>/dev/null)"
fi
if [[ -f ~/.cargo/env ]]; then
source ~/.cargo/env
fi
if gimme --version &>/dev/null; then
eval "$(gimme '1.17.5')" 2>/dev/null
export GOPATH="$HOME/go"
fi
CDPATH="$HOME/code:$HOME/src:$HOME/Development/src:$HOME/repos"
for prefix in github.com github.com/meatballhat code.google.com/p ; do
CDPATH="$HOME/go/src/$prefix:$CDPATH"
done
export GPG_TTY=$(tty)
function dump-ssh-agent() {
env | awk '/SSH/ {
sub(/=/, "=\"", $1)
sub(/$/, "\"", $1)
print "export " $1
}' | tee ~/.ssh/agent.out
}
function load-ssh-agent() {
source ~/.ssh/agent.out
}
function start-ssh-agent() {
ssh-agent >~/.ssh/agent.out
}
function setup-ssh-agent() {
start-ssh-agent && load-ssh-agent
}
function __maybesource() {
if [[ -f "${1}" ]]; then
if [[ "${2}" == silent ]]; then
source "${1}" &>/dev/null
else
source "${1}"
fi
fi
}
function docker-cleanup() {
local once
if [[ "${1}" == once ]]; then
once=1
fi
while true; do
date -u
echo ----
docker images --filter='dangling=true' -q |
xargs docker rmi
if [[ "${once}" == 1 ]]; then
return
fi
for i in {0..9}; do
echo -n z
sleep 1
done
echo
done
}
load-ssh-agent &>/dev/null
export NVM_DIR="${HOME}/.nvm"
__maybesource ~/.zshenv
__maybesource ~/google-cloud-sdk/path.zsh.inc
__maybesource ~/google-cloud-sdk/completion.zsh.inc
__maybesource /usr/share/nvm/init-nvm.sh silent
__maybesource /usr/local/opt/nvm/nvm.sh silent
__maybesource "${NVM_DIR}/nvm.sh"
__maybesource ~/.kiex/scripts/kiex
__maybesource ~/.config/tabtab/__tabtab.zsh
__maybesource ~/.sdkman/bin/sdkman-init.sh
if [[ -f ~/perl5/lib/perl5/local/lib.pm ]]; then
eval "$(perl -I ~/perl5/lib/perl5 '-Mlocal::lib')"
fi
if [[ -d /usr/local/opt/python@3.8/lib ]]; then
export LDFLAGS="-L/usr/local/opt/python@3.8/lib"
fi
if [[ -d /usr/local/opt/python@3.8/lib/pkgconfig ]]; then
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"
fi
if nvm &>/dev/null; then
nvm use --delete-prefix lts/erbium --silent
fi
if kitty --version &>/dev/null; then
autoload -Uz compinit
compinit
kitty + complete setup zsh | source /dev/stdin
fi
true