Refactor setup workflow
This commit is contained in:
80
Zsh/.zshrc
Normal file
80
Zsh/.zshrc
Normal file
@@ -0,0 +1,80 @@
|
||||
# .zshrc
|
||||
|
||||
# Zsh Configuration
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Programming Languages Root
|
||||
export PROG_DIR="$HOME/.programming"
|
||||
|
||||
PROMPT="%B%~%b :: "
|
||||
RPROMPT="%n@%m"
|
||||
|
||||
# Plugins
|
||||
plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone rust nvm golang conda pyenv)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Go and GVM (Black Box)
|
||||
export GOPATH="$PROG_DIR/go"
|
||||
export GVM_ROOT="$GOPATH"
|
||||
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
|
||||
|
||||
# Node and NVM (Lazy Load)
|
||||
export NVM_DIR="$PROG_DIR/node"
|
||||
|
||||
nvm_load() {
|
||||
echo "💤 Waking up NVM..."
|
||||
unset -f nvm node npm npx
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
||||
"$@"
|
||||
}
|
||||
|
||||
nvm() { nvm_load "nvm" "$@"; }
|
||||
node() { nvm_load "node" "$@"; }
|
||||
npm() { nvm_load "npm" "$@"; }
|
||||
npx() { nvm_load "npx" "$@"; }
|
||||
|
||||
# Rust and Cargo
|
||||
export RUSTUP_HOME="$PROG_DIR/rust/multirust"
|
||||
export CARGO_HOME="$PROG_DIR/rust/cargo"
|
||||
|
||||
# Python (Pyenv + Miniconda)
|
||||
export PYENV_ROOT="$PROG_DIR/python/pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
|
||||
if command -v pyenv 1>/dev/null 2>&1; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
if command -v conda >/dev/null 2>&1; then
|
||||
CONDA_BASE=$(conda info --base)
|
||||
[ -f "$CONDA_BASE/etc/profile.d/conda.sh" ] && source "$CONDA_BASE/etc/profile.d/conda.sh"
|
||||
fi
|
||||
|
||||
# R and Rig
|
||||
export RIG_HOME="$PROG_DIR/r"
|
||||
if [ -d "$RIG_HOME/bin" ]; then
|
||||
export PATH="$RIG_HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Zoxide
|
||||
if command -v zoxide >/dev/null 2>&1; then
|
||||
eval "$(zoxide init --cmd cd zsh)"
|
||||
fi
|
||||
|
||||
# Source Aliases & Secrets
|
||||
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
|
||||
[ -f ~/.zsh_secrets ] && source ~/.zsh_secrets
|
||||
|
||||
# Add to PATH
|
||||
export PATH="$HOME/.local/bin:$CARGO_HOME/bin:$GOPATH/bin:$PATH"
|
||||
|
||||
# opencode
|
||||
if command -v openchamber >/dev/null 2>&1 && ! pgrep -f "openchamber.*7891" > /dev/null; then
|
||||
openchamber --port 7891 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# direnv
|
||||
if command -v direnv >/dev/null 2>&1; then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
Reference in New Issue
Block a user