Port of Kali's stock kali-zsh-config as ~/.config/zsh/kali-comforts.sh: twoline prompt, menu-select + case-insensitive completion, keybindings, color aliases, syntax-highlight palette. Loaded last; omz untouched. Details + UAT: https://projects.knownelement.com/issues/612#note-3343
131 lines
4.1 KiB
Plaintext
131 lines
4.1 KiB
Plaintext
# CNW zshrc — chezmoi-managed (dotfiles repo, Redmine #612)
|
|
# Home base: ultix-streaming (VM 5111). Minimal interactive footprint
|
|
# anywhere else; heavy lifting happens in containers.
|
|
#
|
|
# Layers: oh-my-zsh + Kali-style prompt/completions (kali-comforts.sh),
|
|
# fzf, vi mode, ~/.config/zsh/* snippets. powerlevel10k stays installed
|
|
# as the fallback prompt (KALI_PROMPT=0).
|
|
|
|
#####################################################################
|
|
# oh-my-zsh
|
|
#####################################################################
|
|
|
|
export ZSH="$HOME/.oh-my-zsh"
|
|
|
|
# Prompt: Kali twoline by default (kali-comforts.sh applies it last).
|
|
# KALI_PROMPT=0 flips back to powerlevel10k.
|
|
KALI_PROMPT=${KALI_PROMPT:-1}
|
|
if [[ "$KALI_PROMPT" == 1 ]]; then
|
|
ZSH_THEME=""
|
|
else
|
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
|
fi
|
|
|
|
# externals in .chezmoiexternal.toml own updates
|
|
zstyle ':omz:update' mode disabled
|
|
|
|
# Kali ships command correction OFF — the nagging outweighs the saves
|
|
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
HIST_STAMPS="yyyy-mm-dd"
|
|
|
|
plugins=(
|
|
git
|
|
sudo
|
|
z
|
|
extract
|
|
copypath
|
|
colored-man-pages
|
|
command-not-found
|
|
zsh-completions
|
|
zsh-autosuggestions
|
|
zsh-syntax-highlighting
|
|
)
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
# powerlevel10k loads only when it's the active prompt
|
|
if [[ "$KALI_PROMPT" != 1 ]]; then
|
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
|
fi
|
|
|
|
#####################################################################
|
|
# Creature comforts
|
|
#####################################################################
|
|
|
|
# vi mode, 24x7 — this isn't a holiday inn
|
|
bindkey -v
|
|
export KEYTIMEOUT=1
|
|
set -o vi
|
|
|
|
export EDITOR='vim'
|
|
export VISUAL='vim'
|
|
export PAGER='less'
|
|
export LESS='-R'
|
|
|
|
# Debian's fd-find ships fdfind; make it fd
|
|
command -v fdfind >/dev/null 2>&1 && alias fd='fdfind'
|
|
# Debian's bat ships batcat
|
|
command -v batcat >/dev/null 2>&1 && alias bat='batcat'
|
|
|
|
#####################################################################
|
|
# History
|
|
#####################################################################
|
|
|
|
HISTFILE=~/.zsh_history
|
|
HISTSIZE=10000
|
|
SAVEHIST=50000
|
|
setopt hist_expire_dups_first
|
|
setopt hist_ignore_dups
|
|
setopt hist_verify
|
|
setopt appendhistory
|
|
setopt incappendhistory
|
|
HISTDUP=erase
|
|
alias history="history 0"
|
|
|
|
# DO NOT share history across terminals
|
|
setopt no_share_history
|
|
unsetopt sharehistory
|
|
|
|
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
|
|
|
|
#####################################################################
|
|
# fzf (Debian package paths)
|
|
#####################################################################
|
|
|
|
if [[ -r /usr/share/doc/fzf/examples/key-bindings.zsh ]]; then
|
|
source /usr/share/doc/fzf/examples/key-bindings.zsh
|
|
fi
|
|
if [[ -r /usr/share/doc/fzf/examples/completion.zsh ]]; then
|
|
source /usr/share/doc/fzf/examples/completion.zsh
|
|
fi
|
|
export FZF_DEFAULT_COMMAND='fdfind --type f --hidden --follow --exclude .git 2>/dev/null || rg --files --hidden --glob "!.git" 2>/dev/null'
|
|
command -v fdfind >/dev/null 2>&1 && _fzf_compgen_path() { fdfind --hidden --follow --exclude .git . "$1" 2>/dev/null; }
|
|
|
|
#####################################################################
|
|
# SSH agent — bitwarden agent socket if present (path per-host)
|
|
#####################################################################
|
|
|
|
if [[ -S "$HOME/.bitwarden-ssh-agent.sock" ]]; then
|
|
export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock"
|
|
fi
|
|
|
|
#####################################################################
|
|
# Paths and loaders (conditional — hosts without these skip)
|
|
#####################################################################
|
|
|
|
[[ -r "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env"
|
|
|
|
if command -v mise &> /dev/null; then
|
|
eval "$(mise activate zsh)"
|
|
fi
|
|
|
|
#####################################################################
|
|
# Personal snippets (also chezmoi-managed)
|
|
#####################################################################
|
|
|
|
[[ -r "$HOME/.config/zsh/variables.sh" ]] && source "$HOME/.config/zsh/variables.sh"
|
|
[[ -r "$HOME/.config/zsh/aliases.sh" ]] && source "$HOME/.config/zsh/aliases.sh"
|
|
|
|
# Kali-style prompt + completions (loaded last so its settings win)
|
|
[[ -r "$HOME/.config/zsh/kali-comforts.sh" ]] && source "$HOME/.config/zsh/kali-comforts.sh"
|