dotfiles/zshrc

300 lines
6.3 KiB
Bash
Raw Normal View History

2022-12-08 16:47:49 +00:00
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
2019-05-13 13:45:12 +00:00
[[ "${ZSH_DEBUG}" ]] && set -o xtrace
2013-12-28 17:32:06 +00:00
ZSH=$HOME/.oh-my-zsh
2022-12-08 16:47:49 +00:00
ZSH_THEME="powerlevel10k/powerlevel10k"
2013-12-28 17:32:06 +00:00
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"
if [[ -e "${XDG_RUNTIME_DIR}/ssh-agent.socket" ]]; then
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
fi
2018-12-29 21:40:11 +00:00
path=(
$HOME/.rbenv/shims
$HOME/bin
$HOME/go/bin
$HOME/.local/bin
2018-12-29 21:40:11 +00:00
$HOME/.cargo/bin
$HOME/.rbenv/bin
$HOME/.phpenv/bin
2019-04-15 12:52:33 +00:00
$HOME/.yarn/bin
2021-07-07 14:03:13 +00:00
$HOME/.pulumi/bin
2022-04-28 20:22:38 +00:00
${KREW_ROOT:-$HOME/.krew}/bin
2021-09-25 01:38:16 +00:00
$HOME/.local/bin
2023-01-28 17:00:15 +00:00
$HOME/.nix-profile/bin
2018-12-29 21:40:11 +00:00
$HOME/perl5/bin
2020-03-26 13:47:53 +00:00
$HOME/Library/Python/3.8/bin
/usr/local/opt/python@3.8/bin
2024-12-01 00:44:37 +00:00
/usr/bin/core_perl
2018-12-29 21:40:11 +00:00
/usr/local/sbin
/usr/local/bin
/usr/bin/vendor_perl
/usr/sbin
/usr/bin
/sbin
/bin
/snap/bin
/usr/games
/usr/local/games
2020-03-26 13:47:53 +00:00
/usr/local/texlive/2018/bin/x86_64-darwin
2018-12-29 21:40:11 +00:00
)
2013-12-28 17:32:06 +00:00
plugins=(
2018-08-17 13:02:13 +00:00
archlinux
2024-07-16 03:11:11 +00:00
asdf
2017-06-06 17:54:44 +00:00
aws
azure
2022-04-28 20:22:38 +00:00
brew
2017-06-06 17:54:44 +00:00
bundler
command-not-found
cp
2022-01-03 15:24:30 +00:00
direnv
2017-06-06 17:54:44 +00:00
docker
gem
git
golang
2021-02-25 13:28:15 +00:00
helm
2017-06-06 17:54:44 +00:00
heroku
2022-01-03 15:24:30 +00:00
httpie
2021-02-25 13:28:15 +00:00
kubectl
2017-07-09 01:06:59 +00:00
mercurial
2021-07-28 17:46:58 +00:00
minikube
2021-02-25 13:35:58 +00:00
nmap
node
nvm
2017-06-06 17:54:44 +00:00
pip
2024-05-23 16:20:33 +00:00
podman
2017-06-06 17:54:44 +00:00
postgres
python
rails
rake-fast
rbenv
redis-cli
rsync
ruby
2021-02-25 13:35:58 +00:00
rust
2024-05-20 15:31:15 +00:00
symfony-complete
2017-06-06 17:54:44 +00:00
tmux
vagrant
vi-mode
2021-02-25 13:35:58 +00:00
yarn
2013-12-28 17:32:06 +00:00
)
2022-04-28 20:22:38 +00:00
if [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
if [[ -d ~/.oh-my-zsh/plugins/just/ ]]; then
plugins+=just
fi
2014-11-12 16:00:11 +00:00
fpath=(/usr/local/share/zsh/site-functions $fpath)
2022-11-18 17:07:24 +00:00
fpath=("${HOMEBREW_PREFIX}/share/zsh/site-functions" $fpath)
2014-11-12 16:00:11 +00:00
2013-12-28 17:32:06 +00:00
source $ZSH/oh-my-zsh.sh
2019-03-07 16:04:17 +00:00
unalias gb &>/dev/null
2015-08-19 00:14:39 +00:00
2022-01-03 15:24:30 +00:00
export EDITOR=vim
2020-08-17 02:30:03 +00:00
export PYENV_ROOT="${HOME}/.pyenv"
export SDKMAN_DIR="${HOME}/.sdkman"
2022-01-03 15:24:30 +00:00
export VISUAL=vim
2024-09-06 16:57:34 +00:00
export PTD_CACHE="${HOME}/.local/ptd"
export PTD_ROOT="${HOME}/code/rstudio/ptd/infra"
2017-06-04 23:34:10 +00:00
2014-11-12 16:00:11 +00:00
# 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
2019-03-07 16:04:17 +00:00
if [[ -f ~/.local/bin/aws_zsh_completer.sh ]]; then
source ~/.local/bin/aws_zsh_completer.sh
fi
2017-08-27 14:07:13 +00:00
if command -v xdg-open &>/dev/null; then
alias open=xdg-open
fi
2021-01-25 03:26:14 +00:00
if command -v setxkbmap &>/dev/null; then
alias kbus='setxkbmap -layout us'
alias kbdv='setxkbmap -layout dvorak'
fi
2020-09-15 23:21:33 +00:00
if R --version &>/dev/null; then
2020-09-15 23:28:02 +00:00
alias R='R --no-save --no-restore-data'
2020-09-15 23:21:33 +00:00
fi
2021-02-13 18:06:18 +00:00
if command -v ssh-add &>/dev/null; then
alias ssh-add='ssh-add -t 1h'
fi
2021-05-29 17:10:51 +00:00
if psql --version &>/dev/null; then
alias pgme='psql -d postgres://me@jool.meatballhat.com:15744/me'
fi
2023-12-10 03:56:00 +00:00
if terraform version &>/dev/null; then
alias terraform=tofu
alias tf=tofu
fi
2013-12-28 17:32:06 +00:00
unsetopt correct_all
2013-12-28 17:49:14 +00:00
bindkey '^R' history-incremental-search-backward
2013-12-28 17:32:06 +00:00
if which pyenv >/dev/null; then
2024-09-06 16:57:34 +00:00
if [[ "${HATCH_ENV_ACTIVE}" ]]; then
: skipping pyenv when inside a hatch env
else
path=($HOME/.pyenv/shims $HOME/.pyenv/bin "${path[@]}")
plugins=("${plugins[@]}" pyenv)
eval "$(pyenv init - 2>/dev/null)"
fi
2015-08-19 00:14:39 +00:00
fi
if which phpenv >/dev/null; then
eval "$(phpenv init - 2>/dev/null)"
fi
2015-08-19 00:14:39 +00:00
2018-03-24 02:17:25 +00:00
if [[ -f ~/.cargo/env ]]; then
source ~/.cargo/env
fi
2019-05-13 13:45:12 +00:00
if gimme --version &>/dev/null; then
eval "$(gimme 1.21.4)" 2>/dev/null
2019-05-13 13:45:12 +00:00
export GOPATH="$HOME/go"
fi
2014-09-25 03:42:16 +00:00
cdpath=(
$HOME/code
$HOME/src
)
2013-12-28 17:32:06 +00:00
function __maybesource() {
if [[ -f "${1}" ]]; then
2019-05-13 13:45:12 +00:00
if [[ "${2}" == silent ]]; then
source "${1}" &>/dev/null
else
source "${1}"
fi
fi
}
2017-06-06 17:54:44 +00:00
2020-03-26 13:47:53 +00:00
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
}
2024-09-06 16:57:34 +00:00
function ptd-completion() {
if command -v ptd &>/dev/null; then
eval "$(_PTD_COMPLETE=zsh_source ptd)"
fi
}
function mksecret() {
local nbytes="${1:-42}"
python3 <<EOPYTHON | tr -d '/' | tr -d '+' | cut -b1-$((nbytes - 1))
import secrets
import base64
print(base64.b64encode(secrets.token_bytes(${nbytes} * 2)).decode(), end="")
EOPYTHON
}
2020-06-29 15:22:21 +00:00
export NVM_DIR="${HOME}/.nvm"
__maybesource ~/.zshenv
__maybesource ~/google-cloud-sdk/path.zsh.inc
__maybesource ~/google-cloud-sdk/completion.zsh.inc
2019-05-13 13:45:12 +00:00
__maybesource /usr/share/nvm/init-nvm.sh silent
__maybesource /usr/local/opt/nvm/nvm.sh silent
2020-08-17 02:30:03 +00:00
__maybesource "${NVM_DIR}/nvm.sh"
2022-11-18 17:07:24 +00:00
__maybesource /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh
2017-07-09 01:06:59 +00:00
__maybesource ~/.kiex/scripts/kiex
2020-03-26 13:47:53 +00:00
__maybesource ~/.config/tabtab/__tabtab.zsh
2020-08-17 02:30:03 +00:00
__maybesource ~/.sdkman/bin/sdkman-init.sh
if [[ -f ~/perl5/lib/perl5/local/lib.pm ]]; then
eval "$(perl -I ~/perl5/lib/perl5 '-Mlocal::lib')"
fi
2020-03-26 13:47:53 +00:00
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
2019-05-13 13:45:12 +00:00
if nvm &>/dev/null; then
2023-11-02 00:50:48 +00:00
nvm use --delete-prefix 20 --silent
2019-05-13 13:45:12 +00:00
fi
2024-05-20 15:31:15 +00:00
autoload -Uz compinit
compinit
2020-02-19 03:37:49 +00:00
if kitty --version &>/dev/null; then
kitty + complete setup zsh | source /dev/stdin
fi
2024-05-20 15:31:15 +00:00
compdef _symfony_complete composer
compdef _symfony_complete dep
2024-09-06 16:57:34 +00:00
alias fz=fuzzbucket-client
if ptd --version &>/dev/null; then
ptd-completion
fi
2022-12-08 16:47:49 +00:00
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
2023-11-13 23:30:31 +00:00
true