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

Sat, 28 May 2016 18:30:33 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 28 May 2016 18:30:33 -0400
changeset 328
b3b18ced6949
parent 276
b9c8bfdfe163
child 513
a8caf462bfc0
permissions
-rw-r--r--

add asdf-vm

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
276
b9c8bfdfe163 Avoid ugly prompt on consoles
Meredith Howard <mhoward@roomag.org>
parents: 234
diff changeset
22 PROMPT_DEFAULT_END='❯'
b9c8bfdfe163 Avoid ugly prompt on consoles
Meredith Howard <mhoward@roomag.org>
parents: 234
diff changeset
23 PROMPT_ROOT_END='❯❯❯'
31
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
276
b9c8bfdfe163 Avoid ugly prompt on consoles
Meredith Howard <mhoward@roomag.org>
parents: 234
diff changeset
28 if [[ ! $LC_CTYPE =~ 'UTF-8$' || "$(print -P %l)" =~ '^[0-9v]' ]]
234
a48cd1432365 Try to avoid utf-8 if we don't seem to support it
Meredith Howard <mhoward@roomag.org>
parents: 95
diff changeset
29 then
276
b9c8bfdfe163 Avoid ugly prompt on consoles
Meredith Howard <mhoward@roomag.org>
parents: 234
diff changeset
30 PROMPT_DEFAULT_END='%%'
b9c8bfdfe163 Avoid ugly prompt on consoles
Meredith Howard <mhoward@roomag.org>
parents: 234
diff changeset
31 PROMPT_ROOT_END='#'
234
a48cd1432365 Try to avoid utf-8 if we don't seem to support it
Meredith Howard <mhoward@roomag.org>
parents: 95
diff changeset
32 fi
a48cd1432365 Try to avoid utf-8 if we don't seem to support it
Meredith Howard <mhoward@roomag.org>
parents: 95
diff changeset
33
31
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 # Set required options.
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 setopt promptsubst
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 # Load required modules.
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 autoload -U add-zsh-hook
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 autoload -Uz vcs_info
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 # Add hook for calling vcs_info before each command.
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
42 add-zsh-hook precmd vcs_info
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
43
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
44 # Set vcs_info parameters.
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
45 zstyle ':vcs_info:*' enable git hg
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
46 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
47 zstyle ':vcs_info:*:*' unstagedstr '!'
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
48 zstyle ':vcs_info:*:*' stagedstr '+'
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
49 zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)"
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
50 zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c"
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 zstyle ':vcs_info:*:*' nvcsformats "%~" ""
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53 # Define prompts.
002040b868ff adjusted nicoulaj zsh theme
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
54 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
55 RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}"

mercurial