commit f62402ca2a50e5f86613a2ce93e078ce5732cd86 Author: mwiegand Date: Sun Apr 19 15:59:25 2026 +0200 feat: add zsh configuration diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..6c0eed6 --- /dev/null +++ b/.zshrc @@ -0,0 +1,36 @@ +setopt prompt_subst + +autoload -Uz colors +colors + +precmd() { + local exit_code=$? + local prompt_git_branch + + prompt_git_branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null) + if [[ -n $prompt_git_branch ]]; then + PROMPT_GIT_SEGMENT=" (${prompt_git_branch})" + else + PROMPT_GIT_SEGMENT='' + fi + + if (( exit_code == 0 )); then + PROMPT_ARROW_COLOR='%F{22}' + else + PROMPT_ARROW_COLOR='%F{red}' + fi +} + +PROMPT='%B%1~%b${PROMPT_GIT_SEGMENT} ${PROMPT_ARROW_COLOR}%B❯%b%f ' + +source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh + +autoload -Uz up-line-or-beginning-search +autoload -Uz down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +bindkey '^[[A' up-line-or-beginning-search +bindkey '^[[B' down-line-or-beginning-search +bindkey '^[OA' up-line-or-beginning-search +bindkey '^[OB' down-line-or-beginning-search