diff --git a/Brewfile b/Brewfile index d38d3d4..c1eca77 100644 --- a/Brewfile +++ b/Brewfile @@ -91,6 +91,8 @@ brew "ctags" brew "diffutils" # Activates NFS on docker-machine brew "docker-machine-nfs" +# Modern replacement for ls with git integration and icons +brew "eza" # Image processing and image analysis library brew "leptonica" # Subtitle renderer for the ASS/SSA subtitle format @@ -259,6 +261,8 @@ brew "wxwidgets" brew "yarn" # Process YAML, JSON, XML, CSV and properties documents from the CLI brew "yq" +# Smarter cd command (jump to frecent directories) +brew "zoxide" # Kubernetes CLI To Manage Your Clusters In Style! brew "derailed/k9s/k9s" # Vault diff --git a/dot_bash_profile.tmpl b/dot_bash_profile.tmpl index 9f501bd..91048ed 100644 --- a/dot_bash_profile.tmpl +++ b/dot_bash_profile.tmpl @@ -100,6 +100,15 @@ path_append "$HOME/.opencode/bin" export CHEZMOI_GH_TOKEN_OP_REF='{{ if hasKey . "gh" }}{{ .gh.tokenOpRef }}{{ else }}{{ env "CHEZMOI_GH_TOKEN_OP_REF" }}{{ end }}' {{- end }} +if [ -d "$HOME/.config/chezmoi/profile.d" ]; then + for _chez_profile_d in "$HOME"/.config/chezmoi/profile.d/*.sh; do + [ -r "$_chez_profile_d" ] || continue + # shellcheck source=/dev/null + . "$_chez_profile_d" + done + unset _chez_profile_d +fi + {{- if ne .chezmoi.os "windows" }} if [ -z "$INTELLIJ_ENVIRONMENT_READER" ] && command -v mise >/dev/null 2>&1; then eval "$(mise activate bash)" @@ -114,8 +123,8 @@ if [ -z "$INTELLIJ_ENVIRONMENT_READER" ] && command -v mise >/dev/null 2>&1; the export __MISE_EXE fi fi -if [ -z "$INTELLIJ_ENVIRONMENT_READER" ] && command -v zoxide >/dev/null 2>&1; then - eval "$(zoxide init bash)" +if type chez_init_zoxide_cd >/dev/null 2>&1; then + chez_init_zoxide_cd fi {{- end }} @@ -166,15 +175,6 @@ aprompt () { oprompt "$@" } -if [ -d "$HOME/.config/chezmoi/profile.d" ]; then - for _chez_profile_d in "$HOME"/.config/chezmoi/profile.d/*.sh; do - [ -r "$_chez_profile_d" ] || continue - # shellcheck source=/dev/null - . "$_chez_profile_d" - done - unset _chez_profile_d -fi - ghpersonalauth () { local config_dir config_dir="${CHEZMOI_GH_CONFIG_DIR:-$HOME/.config/gh-personal}" diff --git a/dot_config/bat/config b/dot_config/bat/config index cd52388..db9bb8c 100644 --- a/dot_config/bat/config +++ b/dot_config/bat/config @@ -1,3 +1,6 @@ # Match Neovim tokyonight-night (see dot_config/bat/themes/tokyonight_night.tmTheme). --theme="tokyonight_night" --style="plain" + +# Chezmoi templates use .tmpl; map to Bash (see ranger executable_scope.sh). +--map-syntax="*.tmpl:Bash" diff --git a/dot_config/chezmoi/profile.d/00-agent-shell.sh b/dot_config/chezmoi/profile.d/00-agent-shell.sh new file mode 100644 index 0000000..b08f5b9 --- /dev/null +++ b/dot_config/chezmoi/profile.d/00-agent-shell.sh @@ -0,0 +1,13 @@ +# Agent subprocess detection for profile.d consumers (e.g. zoxide-init). +# Load first (00- prefix) so later snippets can branch before smart-cd init. + +_is_agent_shell() { + # Cursor IDE / CLI agent (https://cursor.com/docs/agent/tools/terminal) + [ -n "${CURSOR_AGENT:-}" ] && return 0 + # Claude Code bash tool / hooks (https://code.claude.com/docs/en/env-vars) + [ "${CLAUDECODE:-}" = "1" ] && return 0 + # Explicit opt-in for other agent shells (e.g. OpenCode bash tool via + # opencode.json "env": { "CUSTOM_AGENT_SHELL": "1" }) + [ -n "${CUSTOM_AGENT_SHELL:-}" ] && return 0 + return 1 +} diff --git a/dot_config/chezmoi/profile.d/eza-aliases.sh b/dot_config/chezmoi/profile.d/eza-aliases.sh new file mode 100644 index 0000000..b780589 --- /dev/null +++ b/dot_config/chezmoi/profile.d/eza-aliases.sh @@ -0,0 +1,10 @@ +# Directory listing aliases backed by eza (https://github.com/eza-community/eza). +if command -v eza >/dev/null 2>&1; then + alias ls='eza --color=auto --group-directories-first --icons=auto' + alias l='eza --color=auto --group-directories-first --icons=auto' + alias ll='eza -l --color=auto --group-directories-first --icons=auto --git' + alias la='eza -a --color=auto --group-directories-first --icons=auto' + alias lla='eza -la --color=auto --group-directories-first --icons=auto --git' + alias lt='eza --tree --color=auto --group-directories-first --icons=auto' + alias lS='eza -l --sort=size --color=auto --group-directories-first --icons=auto' +fi diff --git a/dot_config/chezmoi/profile.d/zoxide-init.sh.tmpl b/dot_config/chezmoi/profile.d/zoxide-init.sh.tmpl new file mode 100644 index 0000000..931d119 --- /dev/null +++ b/dot_config/chezmoi/profile.d/zoxide-init.sh.tmpl @@ -0,0 +1,28 @@ +{{- if ne .chezmoi.os "windows" }} +# zoxide: replace cd with smart jumps in human shells. Loaded from profile.d but +# must run after mise activate (see dot_bash_profile / dot_zshrc) so mise does not +# overwrite zoxide's cd with __zsh_like_cd. + +chez_init_zoxide_cd() { + if [ -n "${INTELLIJ_ENVIRONMENT_READER:-}" ] || ! command -v zoxide >/dev/null 2>&1; then + return 0 + fi + if type _is_agent_shell >/dev/null 2>&1 && _is_agent_shell; then + return 0 + fi + + if [ -n "${ZSH_VERSION:-}" ]; then + eval "$(zoxide init zsh --cmd cd)" + else + eval "$(zoxide init bash --cmd cd)" + # Bash: zoxide uses plain `builtin cd` and does not run chpwd_functions, so + # re-wrap __zoxide_cd to keep mise hook-env on directory changes. + if declare -F _mise_hook_chpwd >/dev/null 2>&1 && declare -F __zoxide_cd >/dev/null 2>&1; then + eval "$(declare -f __zoxide_cd | sed '1s/__zoxide_cd/__zoxide_cd_orig/')" + __zoxide_cd() { + __zoxide_cd_orig "$@" && _mise_hook_chpwd + } + fi + fi +} +{{- end }} diff --git a/dot_config/jj/config.toml.tmpl b/dot_config/jj/config.toml.tmpl index e49106a..35d3914 100644 --- a/dot_config/jj/config.toml.tmpl +++ b/dot_config/jj/config.toml.tmpl @@ -48,6 +48,12 @@ email = {{ .git.personal.email | quote }} [--scope.signing] key = {{ .git.personal.signingkey | quote }} +# Delta does not recognize .tmpl; default to Bash in chezmoi/dotfiles repos. +[[--scope]] +--when.repositories = [{{ $dotfilesRepoDir | quote }}, {{ $chezmoiSourceDir | quote }}] +[--scope.ui] +pager = ["delta", "--default-language", "bash"] + [[--scope]] --when.repositories = ["~/dev/repos/github.com/{{ $personalGithubUser }}"] [--scope.user] diff --git a/dot_gitconfig-chezmoi.tmpl b/dot_gitconfig-chezmoi.tmpl new file mode 100644 index 0000000..f59ce89 --- /dev/null +++ b/dot_gitconfig-chezmoi.tmpl @@ -0,0 +1,4 @@ +# Chezmoi source uses .tmpl extensions that delta/syntect do not recognize. +# Treat unknown extensions as Bash (matches ranger preview and most tmpl content). +[delta] + default-language = bash diff --git a/dot_gitconfig.tmpl b/dot_gitconfig.tmpl index 7fddb0e..4ed6042 100644 --- a/dot_gitconfig.tmpl +++ b/dot_gitconfig.tmpl @@ -134,3 +134,11 @@ path = ~/.gitconfig-personal [includeIf "gitdir/i:{{ $chezmoiSourceGitDir }}"] path = ~/.gitconfig-personal +[includeIf "gitdir:{{ $chezmoiSourceGitDir }}"] + path = ~/.gitconfig-chezmoi +[includeIf "gitdir/i:{{ $chezmoiSourceGitDir }}"] + path = ~/.gitconfig-chezmoi +[includeIf "gitdir:{{ $dotfilesGitDir }}"] + path = ~/.gitconfig-chezmoi +[includeIf "gitdir/i:{{ $dotfilesGitDir }}"] + path = ~/.gitconfig-chezmoi diff --git a/dot_tool-versions b/dot_tool-versions index 3b7ac9f..4593d24 100644 --- a/dot_tool-versions +++ b/dot_tool-versions @@ -1,8 +1,7 @@ -dart 2.19.6 -java corretto-21.0.2.13.1 -python 3.13.0 +dart 2.19.6 +java corretto-21.0.2.13.1 golang latest nodejs 18.20.8 -maven 3.9.11 -pnpm latest -vale latest +maven 3.9.11 +pnpm latest +vale latest diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl index 29535a2..bedcc99 100644 --- a/dot_zshrc.tmpl +++ b/dot_zshrc.tmpl @@ -11,6 +11,15 @@ export AI_TERM_CMD="opencode" export CHEZMOI_GH_TOKEN_OP_REF='{{ if hasKey . "gh" }}{{ .gh.tokenOpRef }}{{ else }}{{ env "CHEZMOI_GH_TOKEN_OP_REF" }}{{ end }}' {{- end }} +if [[ -d "$HOME/.config/chezmoi/profile.d" ]]; then + for _chez_profile_d in "$HOME"/.config/chezmoi/profile.d/*.sh(N); do + [[ -r "$_chez_profile_d" ]] || continue + # shellcheck source=/dev/null + . "$_chez_profile_d" + done + unset _chez_profile_d +fi + {{- if ne .chezmoi.os "windows" }} if command -v mise >/dev/null 2>&1; then eval "$(mise activate zsh)" @@ -21,6 +30,9 @@ if command -v mise >/dev/null 2>&1; then export __MISE_EXE fi fi +if typeset -f chez_init_zoxide_cd >/dev/null 2>&1; then + chez_init_zoxide_cd +fi if [ -z "${INTELLIJ_ENVIRONMENT_READER:-}" ] && [ -f "$HOME/.config/oh-my-posh/shell-init.sh" ]; then # shellcheck source=/dev/null . "$HOME/.config/oh-my-posh/shell-init.sh" zsh @@ -54,15 +66,6 @@ aprompt () { oprompt "$@" } -if [[ -d "$HOME/.config/chezmoi/profile.d" ]]; then - for _chez_profile_d in "$HOME"/.config/chezmoi/profile.d/*.sh(N); do - [[ -r "$_chez_profile_d" ]] || continue - # shellcheck source=/dev/null - . "$_chez_profile_d" - done - unset _chez_profile_d -fi - ghpersonalauth () { local config_dir config_dir="${CHEZMOI_GH_CONFIG_DIR:-$HOME/.config/gh-personal}"