Files
dotfiles/home/.chezmoitemplates/scripts/commonrc.sh.tmpl
Ryan Walters 02b9236ecf feat: major dotfiles refactor with documentation and multi-platform improvements
- Add comprehensive CLAUDE.md with chezmoi best practices and AI assistant guidelines
- Restructure TODO.md with prioritized tasks and detailed organization
- Add PowerShell profile template for Windows platform support
- Split git configs into identity-specific templates (ryan/xevion)
- Convert nushell env.nu and gitconfig to templates for cross-platform rendering
- Refactor chezmoi hooks to TypeScript (.init_pre.ts, .update_pre.ts)
- Update .chezmoiignore with better platform-specific file handling
- Remove deprecated shellchecker.sh and tasks.json from VS Code config
- Add mise integration to shell configs (bash, zsh, nushell, PowerShell)
- Clean up commonrc.sh.tmpl WSL-specific code
- Disable Deno in VS Code settings, enable simple dialog mode
- Add nushell extension recommendation to VS Code

This commit establishes better cross-platform support (Windows/WSL/Linux),
improves documentation for future maintenance, and standardizes configuration
management patterns across the repository.
2025-10-26 17:01:45 -05:00

130 lines
3.7 KiB
Bash

# This template's argument is the shell as a string (bash, zsh).
# general configuration
export EDITOR="micro"
export GPG_TTY=$(tty)
export MICRO_TRUECOLOR=1
export TERM=xterm-256color # fixes terminal colors when ssh'ing into laptop
# authentication
export OPENAI_API_KEY="{{ dopplerProjectJson.OPENAI_CHATGPT_CLI }}"
# hishtory
export HISHTORY_SERVER="https://hsh.{{ .data.privateDomain }}"
export PATH="$PATH:$HOME/.hishtory"
{{ if eq .shell "zsh" -}}
source $HOME/.hishtory/config.zsh
{{ else if eq .shell "bash" -}}
source $HOME/.hishtory/config.sh
{{- else -}}
{{ fail "Unexpected shell." }}
{{- end }}
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$PATH:~/.local/bin
export PATH=$PATH:/usr/local/go/bin # Go
export PATH="$HOME/go/bin/:$PATH" # Go-installed tools
export PATH="$HOME/.local/share/bob/nvim-bin:$PATH" # Bob, the Neovim package manager
if [ -d "$HOME/.deno" ]; then
. "$HOME/.deno/env" # Deno
fi
. "$HOME/.cargo/env" # Rustup + Cargo + Cargo-installed tools
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # Brew
command -v rbenv &> /dev/null && eval "$(rbenv init -)" # rbenv for Ruby
command -v chatgpt &> /dev/null && . <(chatgpt --set-completions {{ .shell -}}) # chatgpt completions
{{ if eq .shell "bash" -}}
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"
{{- end }}
# 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 -)"
# pyenv virtual-env
eval "$(pyenv virtualenv-init -)"
fi
fi
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
# java version manager
if [ -d $HOME/.jenv/bin ]; then
export PATH="$HOME/.jenv/bin:$PATH"
if command -v jenv &> /dev/null
then
eval "$(jenv init -)"
fi
fi
if command -v hass-cli &> /dev/null; then
export HASS_SERVER={{ dopplerProjectJson.HASS_SERVER_URL }}
export HASS_TOKEN={{ dopplerProjectJson.HASS_SERVER_TOKEN }}
{{ if eq .shell "bash" -}}
source <(_HASS_CLI_COMPLETE=bash_source hass-cli)
{{ else if eq .shell "zsh" -}}
source <(_HASS_CLI_COMPLETE=zsh_source hass-cli)
{{ else if eq .shell "fish" -}}
eval (_HASS_CLI_COMPLETE=fish_source hass-cli)
{{ end }}
fi
# pnpm
export PNPM_HOME="$HOME/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# perl
if [ -d "$HOME/perl5" ]; then
PATH="$HOME/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="$HOME/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="$HOME/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"$HOME/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"; export PERL_MM_OPT;
fi
# spicetify
if [ -d "$HOME/.spicetify" ]; then
export PATH=$PATH:$HOME/.spicetify
fi
# pulumi
if [ -d "$HOME/.pulumi/bin" ]; then
export PATH=$PATH:$HOME/.pulumi/bin
fi
# load aliases (note: omz aliases are supposed to be placed in ZSH_CUSTOM?)
. $HOME/.bash_aliases
{{- /* WSL-specific settings */ -}}
{{- if .data.wsl }}
## Ensures CLI apps open URLs in the default Windows browser (Chrome/Firefox/etc) instead of a CLI browser
export BROWSER='powershell.exe /c start'
{{- end }}
# dotnet
if [ -d "$HOME/.dotnet" ]; then
export DOTNET_ROOT="$HOME/.dotnet"
export PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools"
fi
# disable screen blanking
# source $(brew --prefix)/share/zsh/site-functions/_todoist_peco
# xset s off && xset -dpms
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='micro'
# else
# export EDITOR='nvim'
# fi