Fun with work-ish zsh stuff

This commit is contained in:
Dan Buch 2024-09-06 12:57:34 -04:00
parent f27cf30bd9
commit 946c21e03f
Signed by: meatballhat
GPG Key ID: A12F782281063434

37
zshrc
View File

@ -42,14 +42,12 @@ fi
path=( path=(
$HOME/.rbenv/shims $HOME/.rbenv/shims
$HOME/.pyenv/shims
$HOME/bin $HOME/bin
$HOME/go/bin $HOME/go/bin
$HOME/.local/bin $HOME/.local/bin
$HOME/.cargo/bin $HOME/.cargo/bin
$HOME/.rbenv/bin $HOME/.rbenv/bin
$HOME/.phpenv/bin $HOME/.phpenv/bin
$HOME/.pyenv/bin
$HOME/.yarn/bin $HOME/.yarn/bin
$HOME/.pulumi/bin $HOME/.pulumi/bin
${KREW_ROOT:-$HOME/.krew}/bin ${KREW_ROOT:-$HOME/.krew}/bin
@ -97,7 +95,6 @@ plugins=(
pip pip
podman podman
postgres postgres
pyenv
python python
rails rails
rake-fast rake-fast
@ -109,7 +106,6 @@ plugins=(
symfony-complete symfony-complete
tmux tmux
vagrant vagrant
vault
vi-mode vi-mode
yarn yarn
) )
@ -133,6 +129,8 @@ export EDITOR=vim
export PYENV_ROOT="${HOME}/.pyenv" export PYENV_ROOT="${HOME}/.pyenv"
export SDKMAN_DIR="${HOME}/.sdkman" export SDKMAN_DIR="${HOME}/.sdkman"
export VISUAL=vim export VISUAL=vim
export PTD_CACHE="${HOME}/.local/ptd"
export PTD_ROOT="${HOME}/code/rstudio/ptd/infra"
# The completion for aws is not compatible with $fpath :scream_cat: # 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
@ -173,7 +171,13 @@ unsetopt correct_all
bindkey '^R' history-incremental-search-backward bindkey '^R' history-incremental-search-backward
if which pyenv >/dev/null; then if which pyenv >/dev/null; then
eval "$(pyenv init - 2>/dev/null)" 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 fi
if which phpenv >/dev/null; then if which phpenv >/dev/null; then
@ -226,6 +230,23 @@ function docker-cleanup() {
done done
} }
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
}
export NVM_DIR="${HOME}/.nvm" export NVM_DIR="${HOME}/.nvm"
__maybesource ~/.zshenv __maybesource ~/.zshenv
@ -265,6 +286,12 @@ fi
compdef _symfony_complete composer compdef _symfony_complete composer
compdef _symfony_complete dep 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. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh