mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 02:24:11 -06:00
- Add fzf.fish keybinding customization (remap variables, preserve Atuin history) - Add Fisher plugin auto-update hook for chezmoi apply - Set Vivaldi as default browser on native Linux - Improve commit-staged command instructions - Add Kitty font size configuration
182 lines
5.7 KiB
Bash
182 lines
5.7 KiB
Bash
# Common shell configuration for Bash
|
|
# This template's argument is the shell as a string (bash, ...).
|
|
#
|
|
# Load order: ~/.bashrc → commonrc.sh.tmpl → ~/.bash_aliases
|
|
# Fish equivalent: ~/.config/fish/config.fish → commonrc.fish.tmpl
|
|
|
|
export EDITOR="micro"
|
|
export GPG_TTY=$(tty)
|
|
export MICRO_TRUECOLOR=1
|
|
export TERM=xterm-256color # fixes terminal colors when ssh'ing into laptop
|
|
|
|
export OPENAI_API_KEY="{{ dopplerProjectJson.OPENAI_CHATGPT_CLI }}"
|
|
|
|
# hishtory configuration
|
|
export HISHTORY_SERVER="https://hsh.{{ dopplerProjectJson.PRIVATE_DOMAIN }}"
|
|
|
|
# Tools are organized in priority order (first = highest priority in PATH)
|
|
# This order matches the Fish config for consistency
|
|
|
|
## Core system paths
|
|
[ -d "$HOME/bin" ] && export PATH="$HOME/bin:$PATH"
|
|
[ -d "/usr/local/bin" ] && export PATH="/usr/local/bin:$PATH"
|
|
[ -d "$HOME/.local/bin" ] && export PATH="$PATH:$HOME/.local/bin"
|
|
|
|
## Shell history
|
|
[ -d "$HOME/.hishtory" ] && export PATH="$PATH:$HOME/.hishtory"
|
|
|
|
## Language Runtimes
|
|
# Go
|
|
[ -d "/usr/local/go/bin" ] && export PATH="$PATH:/usr/local/go/bin"
|
|
[ -d "$HOME/go/bin" ] && export PATH="$HOME/go/bin:$PATH"
|
|
|
|
# Deno (JavaScript/TypeScript runtime)
|
|
[ -d "$HOME/.deno" ] && . "$HOME/.deno/env"
|
|
|
|
# Rust/Cargo (Rustup + Cargo + Cargo-installed tools)
|
|
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
|
|
|
## Package Managers
|
|
# Homebrew (cached for performance - reduces startup time by ~14ms)
|
|
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
|
|
BREW_CACHE="$HOME/.cache/brew_env.sh"
|
|
BREW_BIN="/home/linuxbrew/.linuxbrew/bin/brew"
|
|
|
|
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
|
|
if [ ! -f "$BREW_CACHE" ] || \
|
|
[ $(( $(date +%s) - $(stat -c %Y "$BREW_CACHE" 2>/dev/null || echo 0) )) -gt 604800 ] || \
|
|
[ "$BREW_BIN" -nt "$BREW_CACHE" ]; then
|
|
mkdir -p "$(dirname "$BREW_CACHE")"
|
|
"$BREW_BIN" shellenv > "$BREW_CACHE" 2>/dev/null
|
|
fi
|
|
|
|
[ -f "$BREW_CACHE" ] && . "$BREW_CACHE"
|
|
fi
|
|
|
|
## JavaScript Ecosystem
|
|
# bun (JavaScript runtime and package manager)
|
|
export BUN_INSTALL="$HOME/.bun"
|
|
[ -d "$BUN_INSTALL/bin" ] && export PATH="$BUN_INSTALL/bin:$PATH"
|
|
|
|
# pnpm (Fast, disk space efficient package manager)
|
|
export PNPM_HOME="$HOME/.local/share/pnpm"
|
|
case ":$PATH:" in
|
|
*":$PNPM_HOME:"*) ;;
|
|
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
esac
|
|
|
|
## Development Tools
|
|
# Bob (Neovim version manager)
|
|
[ -d "$HOME/.local/share/bob/nvim-bin" ] && export PATH="$HOME/.local/share/bob/nvim-bin:$PATH"
|
|
|
|
# OpenCode (AI-powered coding assistant)
|
|
[ -d "$HOME/.opencode/bin" ] && export PATH="$PATH:$HOME/.opencode/bin"
|
|
|
|
# Spicetify (Spotify customization CLI)
|
|
[ -d "$HOME/.spicetify" ] && export PATH="$PATH:$HOME/.spicetify"
|
|
|
|
# Pulumi (Infrastructure as Code)
|
|
[ -d "$HOME/.pulumi/bin" ] && export PATH="$PATH:$HOME/.pulumi/bin"
|
|
|
|
# .NET SDK
|
|
if [ -d "$HOME/.dotnet" ]; then
|
|
export DOTNET_ROOT="$HOME/.dotnet"
|
|
export PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools"
|
|
fi
|
|
|
|
# Note: Fish uses mise (via conf.d/mise.fish) for unified version management.
|
|
# Bash uses mise as well, falling back to legacy managers if needed.
|
|
|
|
# mise (unified tool version manager - replaces asdf/pyenv/rbenv/jenv/nvm/etc)
|
|
if command -v mise &> /dev/null; then
|
|
eval "$(mise activate bash)"
|
|
else
|
|
# Legacy version managers (fallback if mise not installed)
|
|
|
|
# pyenv (Python version manager)
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
if [ -d "$PYENV_ROOT/bin" ]; then
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
if command -v pyenv &> /dev/null; then
|
|
eval "$(pyenv init -)"
|
|
eval "$(pyenv virtualenv-init -)"
|
|
fi
|
|
fi
|
|
|
|
# rbenv (Ruby version manager)
|
|
command -v rbenv &> /dev/null && eval "$(rbenv init -)"
|
|
|
|
# jenv (Java version manager)
|
|
if [ -d "$HOME/.jenv/bin" ]; then
|
|
export PATH="$HOME/.jenv/bin:$PATH"
|
|
command -v jenv &> /dev/null && eval "$(jenv init -)"
|
|
fi
|
|
|
|
# asdf (multi-language version manager)
|
|
{{ if eq .shell "bash" -}}
|
|
if [ -f "$HOME/.asdf/asdf.sh" ]; then
|
|
. "$HOME/.asdf/asdf.sh"
|
|
fi
|
|
{{- end }}
|
|
fi
|
|
|
|
# SDKMAN (Java/JVM ecosystem version manager)
|
|
export SDKMAN_DIR="$HOME/.sdkman"
|
|
[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
|
|
|
|
{{ if eq .shell "bash" -}}
|
|
# hishtory shell integration
|
|
[ -f "$HOME/.hishtory/config.sh" ] && source "$HOME/.hishtory/config.sh"
|
|
|
|
# asdf completions (if using legacy asdf instead of mise)
|
|
if [ -f "$HOME/.asdf/completions/asdf.bash" ]; then
|
|
. "$HOME/.asdf/completions/asdf.bash"
|
|
fi
|
|
{{- else -}}
|
|
{{ fail "Unexpected shell." }}
|
|
{{- end }}
|
|
|
|
# chatgpt CLI completions
|
|
command -v chatgpt &> /dev/null && . <(chatgpt --set-completions {{ .shell }})
|
|
|
|
[ -f "$HOME/.bash_aliases" ] && . "$HOME/.bash_aliases"
|
|
|
|
# SSH editor override (always use micro when connected via SSH)
|
|
if [[ -n $SSH_CONNECTION ]]; then
|
|
export EDITOR='micro'
|
|
fi
|
|
|
|
{{- if .data.wsl }}
|
|
|
|
# Windows browser integration (open URLs in Windows browser, not CLI browser)
|
|
export BROWSER='powershell.exe /c start'
|
|
|
|
# Cursor IDE CLI (Windows installation accessible from WSL)
|
|
[ -x /mnt/c/Users/Xevion/AppData/Local/Programs/cursor/resources/app/bin/cursor ] && \
|
|
export PATH="$PATH:/mnt/c/Users/Xevion/AppData/Local/Programs/cursor/resources/app/bin"
|
|
|
|
# Zed Editor CLI (Windows installation accessible from WSL)
|
|
[ -x /mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin/zed ] && \
|
|
export PATH="$PATH:/mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin"
|
|
|
|
# Windows Terminal helper function (launch WT in current directory)
|
|
wt() {
|
|
if [ $# -eq 0 ]; then
|
|
wt.exe -w 0 sp wsl --cd "$(pwd)"
|
|
else
|
|
wt.exe -w 0 "$@" wsl --cd "$(pwd)"
|
|
fi
|
|
}
|
|
|
|
# SSH key management (keychain loads keys once per WSL session)
|
|
eval `keychain --quiet --eval --agents ssh ~/.ssh/id_rsa`
|
|
{{- else }}
|
|
|
|
# Native Linux browser (use Vivaldi)
|
|
export BROWSER=vivaldi-stable
|
|
{{ end }}
|
|
|
|
# atuin (magical shell history with sync)
|
|
if [ -d "$HOME/.atuin" ]; then
|
|
. "$HOME/.atuin/bin/env"
|
|
fi |