Zsh setup
Zsh config layout, env vars, FZF, and colored man pages. See
shell/zsh-tipsfor runtime behavior.
File layout (XDG)
$ZDOTDIR=~/.config/zsh(set in a tiny~/.zshenv).zprofile→~/.config/zsh/.zprofile— login shells (env, paths).zshrc→~/.config/zsh/.zshrc— interactive shells (completion, prompt, plugins, keys)- History file:
~/.cache/zsh_history - Completion cache:
~/.cache/zsh/zcompdump-$ZSH_VERSION
.zprofile runs first (login), .zshrc after (interactive). Put env in .zprofile, behavior in .zshrc.
XDG dirs (set in .zprofile)
XDG_CONFIG_HOME=$HOME/.config
XDG_DATA_HOME=$HOME/.local/share
XDG_STATE_HOME=$HOME/.local/state
XDG_CACHE_HOME=$HOME/.cache
App-specific relocations:
LESSHISTFILE=$XDG_CACHE_HOME/less_historyPYTHON_HISTORY=$XDG_DATA_HOME/python/historyWORKON_HOME=$XDG_DATA_HOME/.virtualenvs
Default editor
EDITOR=nvim— used byvisudo,crontab -e, git, etc.
PATH
- Custom scripts dir is on PATH:
PATH=$XDG_CONFIG_HOME/scripts:$PATH
FZF env
FZF_DEFAULT_OPTS="--style minimal --color 16 --layout=reverse --height 30% --preview='bat -p --color=always {}'"FZF_CTRL_R_OPTS="--style minimal --color 16 --info inline --no-sort --no-preview"
Ctrl+R history widget set up via source <(fzf --zsh).
Colored man pages
Set in .zprofile:
LESS='-R'
MANPAGER='sh -c "less"'
GROFF_NO_SGR=0
MANROFFOPT='-c'
ANSI escape colors for man formatting:
- Blink → bright red
\e[1;91m - Bold → magenta
\e[1;95m - Underline → bright green
\e[1;92m - Standout → gray bg / white fg
\e[48;5;238;38;5;15m - Line numbers → dim gray
\e[38;5;240m
Dependencies
zoxide— smartcdfzf+bat— fuzzy search with previewszsh-syntax-highlighting— real-time command highlightingzsh-vi-mode(AUR) — replaces built-in zle vi-mode
Reload
source ~/.config/zsh/.zshrc(or just open a new shell)