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