Add README and shell polish
This commit is contained in:
49
Zsh/.zshrc
49
Zsh/.zshrc
@@ -7,14 +7,23 @@ export ZSH="$HOME/.oh-my-zsh"
|
||||
export PROG_DIR="$HOME/.programming"
|
||||
|
||||
# Plugins
|
||||
plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone rust nvm golang conda pyenv)
|
||||
plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone)
|
||||
|
||||
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"
|
||||
|
||||
gvm_load() {
|
||||
unset -f gvm go gofmt
|
||||
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
|
||||
"$@"
|
||||
}
|
||||
|
||||
gvm() { gvm_load gvm "$@"; }
|
||||
go() { gvm_load go "$@"; }
|
||||
gofmt() { gvm_load gofmt "$@"; }
|
||||
|
||||
# Node and NVM (Lazy Load)
|
||||
export NVM_DIR="$PROG_DIR/node"
|
||||
@@ -37,16 +46,25 @@ export CARGO_HOME="$PROG_DIR/rust/cargo"
|
||||
|
||||
# Python (Pyenv + Miniconda)
|
||||
export PYENV_ROOT="$PROG_DIR/python/pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
|
||||
export CONDA_ROOT="$PYENV_ROOT/versions/miniforge3-latest"
|
||||
|
||||
if command -v pyenv 1>/dev/null 2>&1; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
pyenv_load() {
|
||||
unset -f pyenv
|
||||
eval "$(command pyenv init -)"
|
||||
pyenv "$@"
|
||||
}
|
||||
|
||||
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
|
||||
pyenv() { pyenv_load "$@"; }
|
||||
|
||||
conda_load() {
|
||||
unset -f conda mamba
|
||||
[ -f "$CONDA_ROOT/etc/profile.d/conda.sh" ] && source "$CONDA_ROOT/etc/profile.d/conda.sh"
|
||||
"$@"
|
||||
}
|
||||
|
||||
conda() { conda_load conda "$@"; }
|
||||
mamba() { conda_load mamba "$@"; }
|
||||
|
||||
# R and Rig
|
||||
export RIG_HOME="$PROG_DIR/r"
|
||||
@@ -54,6 +72,10 @@ if [ -d "$RIG_HOME/bin" ]; then
|
||||
export PATH="$RIG_HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
is_wsl() {
|
||||
[ -f /proc/version ] && grep -qEi "(Microsoft|WSL)" /proc/version
|
||||
}
|
||||
|
||||
# Zoxide
|
||||
if command -v zoxide >/dev/null 2>&1; then
|
||||
eval "$(zoxide init --cmd cd zsh)"
|
||||
@@ -67,8 +89,8 @@ fi
|
||||
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
|
||||
if is_wsl && command -v openchamber >/dev/null 2>&1 && ! pgrep -f "openchamber.*7891" > /dev/null; then
|
||||
openchamber --port 7891 >/dev/null 2>&1 &!
|
||||
fi
|
||||
|
||||
# direnv
|
||||
@@ -76,5 +98,8 @@ if command -v direnv >/dev/null 2>&1; then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
|
||||
# Completion Styling
|
||||
[ -f ~/.zsh_completion ] && source ~/.zsh_completion
|
||||
|
||||
# Prompt Styling
|
||||
[ -f ~/.zsh_prompt ] && source ~/.zsh_prompt
|
||||
|
||||
Reference in New Issue
Block a user