Files
dotfiles/home/.zshrc
Andrejus 8138d44c73 Replace red with amber, unify palette, add fetch/pull aliases
- Add git aliases: f (fetch), p (pull) and shell aliases: gf, gp
- Replace all #F40404 (red) with #F88C14 (amber) across prompt, gitconfig,
  vim, bat theme, and tmux scripts for colourblind-friendly palette
- Standardise hex case to uppercase throughout
- Unify #728cb8 → #7290B8 (fix blue inconsistency)
- Replace unique #8787AF with palette #7290B8 in gitconfig
- Remove unused red colour definition from prompt.zsh
- Update dark diff backgrounds from red-tinted to amber-tinted

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-25 17:38:47 +00:00

157 lines
5.5 KiB
Bash

# Profiling: ZSH_BENCH=1 zsh
[[ -n "$ZSH_BENCH" ]] && zmodload zsh/zprof
# Upgrade xterm-color to xterm-256color (gh cs ssh sets the weaker value)
[[ "$TERM" == "xterm-color" ]] && export TERM=xterm-256color
# Assume truecolor support if terminal advertises 256color (covers SSH, tmux)
[[ -z "$COLORTERM" && "$TERM" == *256color* ]] && export COLORTERM=truecolor
_dots_cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/dots"
_dots_load_profile() { source "$HOME/.profile" }
_dots_load_profile
_dots_setup_dirs() {
mkdir -p "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" "$HOME/.local/bin" "$WORKSPACE" "$_dots_cache_dir"
}
_dots_setup_dirs
_dots_cache_ls_colors() {
local cache_file="$_dots_cache_dir/ls-colours"
if [[ -f "$cache_file" ]]; then
source "$cache_file"
else
if command -v gls &>/dev/null; then
echo 'alias ls="gls --color=auto"' > "$cache_file"
elif ls --color -d . &>/dev/null 2>&1; then
echo 'alias ls="ls --color=auto"' > "$cache_file"
elif ls -G -d . &>/dev/null 2>&1; then
echo 'alias ls="ls -G"' > "$cache_file"
fi
[[ -f "$cache_file" ]] && source "$cache_file"
fi
export LS_COLORS='di=38;2;44;180;148:ln=38;2;136;64;156:ex=38;2;248;140;20:fi=0:no=0:*.md=38;2;114;144;184:*.json=38;2;114;144;184:*.yml=38;2;114;144;184:*.yaml=38;2;114;144;184:*.toml=38;2;114;144;184'
}
_dots_cache_ls_colors
[[ -f ~/.aliases ]] && source ~/.aliases
_dots_init_completion() {
local comp_dir="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/completions"
[[ -d "$comp_dir" ]] && fpath=("$comp_dir" $fpath)
autoload -Uz compinit
# Daily cache invalidation
local dump="$HOME/.zcompdump"
if [[ -f "$dump" ]]; then
zmodload -F zsh/stat b:zstat 2>/dev/null
local -a dump_stat
zstat -A dump_stat +mtime "$dump" 2>/dev/null
if (( dump_stat[1] > EPOCHSECONDS - 86400 )); then
compinit -C
else
compinit
fi
else
compinit
fi
# Completion styling
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format $'\e[38;2;114;144;184m-- %d --\e[0m'
zstyle ':completion:*:warnings' format $'\e[38;2;248;140;20m-- no matches --\e[0m'
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
}
_dots_init_completion
_dots_load_plugins() {
local plugin_dir="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins"
local f="$plugin_dir/zsh-autosuggestions/zsh-autosuggestions.zsh"
[[ -f "$f" ]] && source "$f"
# Autosuggestion ghost text colour
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#3C3C3C'
# syntax-highlighting must be sourced last
f="$plugin_dir/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
[[ -f "$f" ]] && source "$f"
# Syntax highlighting theme
typeset -gA ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[command]='fg=#2CB494'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=#2CB494'
ZSH_HIGHLIGHT_STYLES[alias]='fg=#2CB494'
ZSH_HIGHLIGHT_STYLES[function]='fg=#2CB494'
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=#F88C14'
ZSH_HIGHLIGHT_STYLES[path]='underline'
ZSH_HIGHLIGHT_STYLES[globbing]='fg=#F88C14'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=#7290B8'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=#7290B8'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='fg=#7290B8'
ZSH_HIGHLIGHT_STYLES[comment]='fg=#808080'
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#2CB494'
ZSH_HIGHLIGHT_STYLES[default]='fg=#CCE0D0'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=#808080'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=#F88C14'
ZSH_HIGHLIGHT_STYLES[option]='fg=#7290B8'
}
_dots_load_plugins
_dots_load_history() {
HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/history"
HISTSIZE=50000
SAVEHIST=50000
[[ -d "${HISTFILE:h}" ]] || mkdir -p "${HISTFILE:h}"
setopt HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY
}
_dots_load_history
setopt IGNORE_EOF
source "$HOME/.zsh/widgets.zsh"
_dots_load_fzf() {
command -v fzf &>/dev/null || return
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS='--style=minimal --layout=reverse --height=40% --border=none --no-scrollbar --prompt="> " --info=inline-right --no-separator --margin=1,0,0,0 --color=fg:#808080,fg+:#CCE0D0,bg:-1,bg+:#1A1A1A --color=hl:#2CB494,hl+:#2CB494,info:#808080,marker:#2CB494 --color=prompt:#2CB494,spinner:#88409C,pointer:#2CB494,header:#808080 --color=border:#3C3C3C,preview-border:#3C3C3C,gutter:#1A1A1A,preview-fg:#CCE0D0'
# fzf --zsh requires v0.48+
if fzf --zsh &>/dev/null; then
source <(fzf --zsh)
else
local -a fzf_paths=(
"${HOMEBREW_PREFIX:-/opt/homebrew}/opt/fzf/shell"
"/usr/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf/shell"
)
for dir in "${fzf_paths[@]}"; do
[[ -f "$dir/key-bindings.zsh" ]] && source "$dir/key-bindings.zsh" && break
done
for dir in "${fzf_paths[@]}"; do
[[ -f "$dir/completion.zsh" ]] && source "$dir/completion.zsh" && break
done
fi
}
_dots_load_zoxide() {
command -v zoxide &>/dev/null || return
export _ZO_FZF_OPTS="$FZF_DEFAULT_OPTS"
export _ZO_ECHO=0
eval "$(zoxide init zsh)"
}
source "$HOME/.zsh/prompt.zsh"
_dots_load_mise() {
command -v mise &>/dev/null && eval "$(mise activate zsh)"
}
_dots_load_mise
_dots_load_fzf
_dots_load_zoxide
[[ -n "$ZSH_BENCH" ]] && zprof || true