Files
dotfiles/roles/zsh/files/.zshrc
Johannes Knopp aae0275e60 update conf
2026-07-09 03:36:38 +02:00

68 lines
2.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000
SAVEHIST=10000
setopt share_history # persist, and share live across open shells
setopt inc_append_history # history of session appended to HISTFILE after session ends
setopt hist_ignore_dups # drop a command identical to the one before it
setopt hist_ignore_space # don't record commands typed with a leading space
setopt hist_save_no_dups
setopt hist_verify # let you edit a !-expansion before it runs
setopt append_history
autoload -Uz compinit
compinit
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' formats ' %F{yellow}%b %f'
zstyle ':vcs_info:git:*' actionformats ' %F{yellow}%b|%a %f'
zstyle ':vcs_info:git*+set-message:*' hooks git-dirty
+vi-git-dirty() {
if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
hook_com[branch]+='%F{red}●%F{yellow}'
fi
}
precmd() { vcs_info }
PROMPT='╭─%B%(!.%F{red}.%F{green})%n@%m%f %F{blue}%~%f%b${vcs_info_msg_0_}
╰─%B%(!.#.$)%b '
RPROMPT='%B%(?..%F{red}%? ↵%f)%b'
expand-or-complete-with-dots() {
print -Pn '%F{red}…%f'
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey '^I' expand-or-complete-with-dots
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
export DOTFILES_ZSH_DIR="$HOME/dotfiles/roles/zsh/files"
for zsh_file in "$DOTFILES_ZSH_DIR"/*.zsh; do
[[ -r "$zsh_file" ]] && source "$zsh_file"
done
ZSH_PLUGINS_DIR="$HOME/.zsh/plugins"
source "$ZSH_PLUGINS_DIR/zsh_autosuggestions/zsh-autosuggestions.zsh"
source "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
bindkey '^H' backward-kill-word # Ctrl+Backspace - delete word
bindkey '^[[3;5~' kill-word # Ctrl+Delete - delete forward word
bindkey '^[[1;5C' forward-word # Ctrl+Right - jump forward a word
bindkey '^[[1;5D' backward-word # Ctrl+Left - jump backward a word
eval "$(zoxide init zsh)"