Making a huge mess of zshrc

This commit is contained in:
2026-06-11 10:25:17 -04:00
parent 5c3059c5cc
commit eb41fed50f
+73 -129
View File
@@ -1,40 +1,14 @@
# 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
[[ "${ZSH_DEBUG}" ]] && set -o xtrace
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="powerlevel10k/powerlevel10k"
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"
DISABLE_AUTO_TITLE="true"
DISABLE_AUTO_UPDATE="true"
DISABLE_CORRECTION="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
ZSH="${HOME}/.oh-my-zsh"
# 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"
export ZSH_THEME='robbyrussell'
if [[ -e "${XDG_RUNTIME_DIR}/ssh-agent.socket" ]]; then
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
@@ -92,14 +66,12 @@ plugins=(
minikube
nmap
node
nvm
pip
podman
postgres
python
rails
rake-fast
rbenv
redis-cli
rsync
ruby
@@ -108,13 +80,8 @@ plugins=(
tmux
vagrant
vi-mode
yarn
)
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
@@ -127,14 +94,17 @@ source $ZSH/oh-my-zsh.sh
unalias gb &>/dev/null
export EDITOR=vim
export GOPATH="${HOME}/go"
export NVM_DIR="${HOME}/.nvm"
export PYENV_ROOT="${HOME}/.pyenv"
export SDKMAN_DIR="${HOME}/.sdkman"
export VISUAL=vim
export PTD_CACHE="${HOME}/.local/ptd"
export PTD_ROOT="${HOME}/code/rstudio/ptd/infra"
GPG_TTY="$(tty)"
export GPG_TTY
# The completion for aws is not compatible with $fpath :scream_cat:
if [[ -f /usr/local/share/zsh/site-functions/_aws ]] ; then
if [[ -f /usr/local/share/zsh/site-functions/_aws ]]; then
source /usr/local/share/zsh/site-functions/_aws
fi
@@ -163,43 +133,10 @@ if psql --version &>/dev/null; then
alias pgme='psql -d postgres://me@jool.meatballhat.com:15744/me'
fi
if terraform version &>/dev/null; then
alias terraform=tofu
alias tf=tofu
fi
unsetopt correct_all
bindkey '^R' history-incremental-search-backward
if which pyenv >/dev/null; then
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
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.21.4)" 2>/dev/null
export GOPATH="$HOME/go"
fi
cdpath=(
$HOME/code
$HOME/src
)
function __maybesource() {
__maybesource() {
if [[ -f "${1}" ]]; then
if [[ "${2}" == silent ]]; then
source "${1}" &>/dev/null
@@ -209,7 +146,56 @@ function __maybesource() {
fi
}
function docker-cleanup() {
brew() {
unset -f brew
if [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
brew "${@}"
}
nvm() {
unset -f nvm
__maybesource /usr/share/nvm/init-nvm.sh silent
__maybesource /usr/local/opt/nvm/nvm.sh silent
__maybesource "${NVM_DIR}/nvm.sh"
__maybesource /home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh
nvm "${@}"
}
pyenv() {
unset -f pyenv
if which pyenv >/dev/null; then
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
fi
pyenv "${@}"
}
phpenv() {
unset -f phpenv
if which phpenv >/dev/null; then
eval "$(phpenv init - 2>/dev/null)"
fi
phpenv "${@}"
}
pnpm() {
unset -f pnpm
export PNPM_HOME="/home/me/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME/bin:"*) ;;
*) export PATH="$PNPM_HOME/bin:$PATH" ;;
esac
pnpm "${@}"
}
docker-cleanup() {
local once
if [[ "${1}" == once ]]; then
once=1
@@ -231,13 +217,7 @@ function docker-cleanup() {
done
}
function ptd-completion() {
if command -v ptd &>/dev/null; then
eval "$(_PTD_COMPLETE=zsh_source ptd)"
fi
}
function mksecret() {
mksecret() {
local nbytes="${1:-42}"
python3 <<EOPYTHON | tr -d '/' | tr -d '+' | cut -b1-$((nbytes - 1))
@@ -248,61 +228,25 @@ print(base64.b64encode(secrets.token_bytes(${nbytes} * 2)).decode(), end="")
EOPYTHON
}
export NVM_DIR="${HOME}/.nvm"
cdpath=(
$HOME/code
$HOME/src
)
__maybesource ~/.cargo/env
__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 /home/linuxbrew/.linuxbrew/opt/nvm/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 20 --silent
fi
GPG_TTY="$(tty)"
export GPG_TTY
autoload -Uz compinit
compinit
if kitty --version &>/dev/null; then
kitty + complete setup zsh | source /dev/stdin
if [[ -n ~/.zcompdump(#qNmh-24) ]]; then
compinit -C
else
compinit
fi
compdef _symfony_complete composer
compdef _symfony_complete dep
alias fz=fuzzbucket-client
if ptd --version &>/dev/null; then
ptd-completion
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# pnpm
export PNPM_HOME="/home/me/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME/bin:"*) ;;
*) export PATH="$PNPM_HOME/bin:$PATH" ;;
esac
# pnpm end