#! /usr/bin/zsh autoload -U colors colors setopt prompt_subst # # Prepare colors, ignoring length # C_NO="%{$reset_color%}" C_BYELLOW="%{${fg_bold[yellow]}%}" C_BRED="%{${fg_bold[red]}%}" C_BCYAN="%{${fg_bold[cyan]}%}" C_GREEN="%{${fg[green]}%}" C_MAGENTA="%{${fg_bold[magenta]}%}" # # Prompt parts # _username="${C_BYELLOW}%n${C_NO}" _machine="${C_BRED}%m${C_NO}" _hour="${C_BCYAN}[%D{%H:%M}]${C_NO}" _exitcode="%(?::${C_BRED}[ %? ]${C_NO} )$(true)" _action="%(3v,%3v%,)" _path='${C_GREEN}%(5v,%20<..<%5v%<<${C_NO}${C_MAGENTA}@%4v%3v${C_NO}${C_GREEN}/%15<..<%6v%<<,%25<..<%~%<<)${C_NO}' # # Now, the prompt itself # #PROMPT="${_exitcode}${_hour} ${_username}@${_machine}:${_vcs}${_path}$ " PROMPT="${_exitcode}${_username}@${_machine}:${_vcs}${_path}$ "