gentoo.zsh.theme (1687B)
1 #!/usr/bin/env zsh 2 # ------------------------------------------------------------------------------ 3 # Prompt for the Zsh shell: 4 # * One line. 5 # * VCS info on the right prompt. 6 # * Only shows the path on the left prompt by default. 7 # * Crops the path to a defined length and only shows the path relative to 8 # the current VCS repository root. 9 # * Wears a different color whether the last command succeeded/failed. 10 # * Shows user@hostname if connected through SSH. 11 # * Shows if logged in as root or not. 12 # ------------------------------------------------------------------------------ 13 14 # Customizable parameters. 15 PROMPT_PATH_MAX_LENGTH=30 16 PROMPT_DEFAULT_END=❯ 17 PROMPT_ROOT_END=❯❯❯ 18 PROMPT_SUCCESS_COLOR=$FG[071] 19 PROMPT_FAILURE_COLOR=$FG[124] 20 PROMPT_VCS_INFO_COLOR=$FG[242] 21 22 # Set required options. 23 setopt promptsubst 24 25 # Load required modules. 26 autoload -U add-zsh-hook 27 autoload -Uz vcs_info 28 29 # Add hook for calling vcs_info before each command. 30 add-zsh-hook precmd vcs_info 31 32 # Set vcs_info parameters. 33 zstyle ':vcs_info:*' enable hg bzr git 34 zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. 35 zstyle ':vcs_info:*:*' unstagedstr '!' 36 zstyle ':vcs_info:*:*' stagedstr '+' 37 zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" 38 zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" 39 zstyle ':vcs_info:*:*' nvcsformats "%~" "" 40 41 # Define prompts. 42 PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} " 43 RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}" 44