Files
ansible-playbooks/roles/zsh/templates/zshrc.j2
T
2026-04-11 22:41:10 +02:00

62 lines
2.3 KiB
Django/Jinja

# {{ ansible_managed }}
export ZSH_PLUGINS={{ zsh_plugins_path }}
# History configuration
HISTFILE={{ zsh_config_path }}/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt EXTENDED_HISTORY # record timestamp of command
setopt HIST_EXPIRE_DUPS_FIRST # delete duplicates first when trimming
setopt HIST_IGNORE_DUPS # ignore duplicated commands
setopt HIST_IGNORE_SPACE # ignore commands starting with space
setopt HIST_VERIFY # show command with history expansion before running
setopt SHARE_HISTORY # share history between sessions
setopt APPEND_HISTORY # append to history file, don't overwrite
# Directory navigation
setopt AUTO_CD # cd by typing directory name
setopt AUTO_PUSHD # push directories on cd
setopt PUSHD_IGNORE_DUPS # don't push duplicates
setopt CORRECT # correct command spelling
setopt NO_BEEP # no beeps
# Completion
autoload -Uz compinit
compinit -C # faster completion (cache)
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
if [[ -r "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Enable powerlevel10k theme
source $ZSH_PLUGINS/powerlevel10k/powerlevel10k.zsh-theme
# Enable autosuggestions (before syntax highlighting)
source $ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh
# Enable history substring search (before keybindings, before syntax highlighting)
source $ZSH_PLUGINS/zsh-history-substring-search/zsh-history-substring-search.zsh
# Enable syntax highlighting (must be loaded last)
source $ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Enable fzf integration (Ctrl+R, Ctrl+T, Alt+C)
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
# Enable fzf-tab for completions (after compinit)
source $ZSH_PLUGINS/fzf-tab/fzf-tab.zsh
# Source fzf-tab config
[[ -f {{ zsh_config_path }}/fzf-tab.zsh ]] && source {{ zsh_config_path }}/fzf-tab.zsh
# Source aliases
[[ -f {{ zsh_config_path }}/aliases ]] && source {{ zsh_config_path }}/aliases
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
# Useful keybindings
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down