.oh-my-zsh/custom/themes/mhoward.zsh-theme

changeset 95
6c1ea6e90a23
parent 94
51ca19919894
child 96
f4808ae73ead
equal deleted inserted replaced
94:51ca19919894 95:6c1ea6e90a23
1 #!/usr/bin/env zsh
2
3 # #####
4 # this is just a tweaked nicoulaj.zsh-theme
5 # #####
6
7 # ------------------------------------------------------------------------------
8 # Prompt for the Zsh shell:
9 # * One line.
10 # * VCS info on the right prompt.
11 # * Only shows the path on the left prompt by default.
12 # * Crops the path to a defined length and only shows the path relative to
13 # the current VCS repository root.
14 # * Wears a different color wether the last command succeeded/failed.
15 # * Shows user@hostname if connected through SSH.
16 # * Shows if logged in as root or not.
17 # ------------------------------------------------------------------------------
18
19
20 # Customizable parameters.
21 PROMPT_PATH_MAX_LENGTH=30
22 PROMPT_DEFAULT_END=❯
23 PROMPT_ROOT_END=❯❯❯
24 PROMPT_SUCCESS_COLOR=$FG[071]
25 PROMPT_FAILURE_COLOR=$FG[124]
26 PROMPT_VCS_INFO_COLOR=$FG[242]
27
28 # Set required options.
29 setopt promptsubst
30
31 # Load required modules.
32 autoload -U add-zsh-hook
33 autoload -Uz vcs_info
34
35 # Add hook for calling vcs_info before each command.
36 add-zsh-hook precmd vcs_info
37
38 # Set vcs_info parameters.
39 zstyle ':vcs_info:*' enable git hg
40 zstyle ':vcs_info:*:*' check-for-changes false # Can be slow on big repos.
41 zstyle ':vcs_info:*:*' unstagedstr '!'
42 zstyle ':vcs_info:*:*' stagedstr '+'
43 zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
44 zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c"
45 zstyle ':vcs_info:*:*' nvcsformats "%~" ""
46
47 # Define prompts.
48 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]%} "
49 RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}"

mercurial