summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/adben.zsh-theme102
-rw-r--r--themes/agnoster.zsh-theme8
-rw-r--r--themes/arrow.zsh-theme2
-rw-r--r--themes/avit.zsh-theme6
-rw-r--r--themes/awesomepanda.zsh-theme2
-rw-r--r--themes/cloud.zsh-theme2
-rw-r--r--themes/edvardm.zsh-theme2
-rw-r--r--themes/essembeh.zsh-theme60
-rw-r--r--themes/fino.zsh-theme29
-rw-r--r--themes/fishy.zsh-theme18
-rw-r--r--themes/flazz.zsh-theme2
-rw-r--r--themes/fwalch.zsh-theme2
-rw-r--r--themes/gallois.zsh-theme15
-rw-r--r--themes/gentoo.zsh-theme30
-rw-r--r--themes/gozilla.zsh-theme2
-rw-r--r--themes/half-life.zsh-theme99
-rw-r--r--themes/jbergantine.zsh-theme2
-rw-r--r--themes/jnrowe.zsh-theme2
-rw-r--r--themes/jtriley.zsh-theme6
-rw-r--r--themes/kafeitu.zsh-theme2
-rw-r--r--themes/linuxonly.zsh-theme30
-rw-r--r--themes/mlh.zsh-theme97
-rw-r--r--themes/muse.zsh-theme43
-rw-r--r--themes/obraun.zsh-theme5
-rw-r--r--themes/peepcode.zsh-theme19
-rw-r--r--themes/pygmalion-virtualenv.zsh-theme10
-rw-r--r--themes/pygmalion.zsh-theme10
-rw-r--r--themes/random.zsh-theme15
-rw-r--r--themes/re5et.zsh-theme2
-rw-r--r--themes/smt.zsh-theme71
-rw-r--r--themes/sunrise.zsh-theme2
-rw-r--r--themes/trapd00r.zsh-theme10
-rw-r--r--themes/ys.zsh-theme20
33 files changed, 437 insertions, 290 deletions
diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
index b9ac77d00..ebdec7c82 100644
--- a/themes/adben.zsh-theme
+++ b/themes/adben.zsh-theme
@@ -29,11 +29,13 @@
# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
# # https://pthree.org/2008/11/23/727/
# # enjoy!
+
########## COLOR ###########
for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do
- eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
- eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
+ eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
+ eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
+
PR_RESET="%{$reset_color%}"
RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} "
RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} "
@@ -44,14 +46,14 @@ DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}"
-# ########## COLOR ###########
-# ########## SVN ###########
+
+########## SVN ###########
ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:"
ZSH_THEME_SVN_PROMPT_SUFFIX=""
ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
-# ########## SVN ###########
-# ########## GIT ###########
+
+########## GIT ###########
ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
@@ -62,53 +64,63 @@ ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}"
ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}"
ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}"
-# ########## GIT ###########
-function precmd {
- #gets the fortune
- ps1_fortune () {
- #Choose from all databases, regardless of whether they are considered "offensive"
- fortune -a
- }
- #obtains the tip
- ps1_command_tip () {
- wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
- }
- prompt_header () {
- if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
- ps1_command_tip
- else
- ps1_fortune
- fi
- }
- PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
- # set a simple variable to show when in screen
- if [[ -n "${WINDOW}" ]]; then
- SCREEN=""
+
+# Get a fortune quote
+ps1_fortune() {
+ (( ${+commands[fortune]} )) && fortune
+}
+
+# Obtain a command tip
+ps1_command_tip() {
+ {
+ if (( ${+commands[wget]} )); then
+ command wget -qO- https://www.commandlinefu.com/commands/random/plaintext
+ elif (( ${+commands[curl]} )); then
+ command curl -fsL https://www.commandlinefu.com/commands/random/plaintext
fi
+ } | sed 1d | sed '/^$/d'
}
-# Context: user@directory or just directory
-prompt_context () {
- if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
- echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+function precmd_adben {
+ prompt_header() {
+ if [[ "$ENABLE_COMMAND_TIP" = true ]]; then
+ ps1_command_tip
else
- echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ ps1_fortune
fi
+ }
+
+ PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
+
+ # set a simple variable to show when in screen
+ if [[ -n "${WINDOW}" ]]; then
+ SCREEN=""
+ fi
}
-set_prompt () {
- # required for the prompt
- setopt prompt_subst
- autoload zsh/terminfo
+# Context: user@directory or just directory
+prompt_context() {
+ if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+ echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ else
+ echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ fi
+}
- # ######### PROMPT #########
- PROMPT='${PROMPT_HEAD}
+########## SETUP ###########
+
+# Required for the prompt
+setopt prompt_subst
+autoload zsh/terminfo
+
+# Prompt
+PROMPT='${PROMPT_HEAD}
${RED_START}$(prompt_context)
${GREEN_START_P1}'
- RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}'
- # Matching continuation prompt
- PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
- # ######### PROMPT #########
-}
+RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}'
+# Matching continuation prompt
+PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
-set_prompt
+# Prompt head
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd precmd_adben
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 8c700d06a..fe7ddbac6 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -88,7 +88,7 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
- if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+ if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
fi
}
@@ -106,7 +106,7 @@ prompt_git() {
}
local ref dirty mode repo_path
- if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
+ if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
@@ -131,7 +131,7 @@ prompt_git() {
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
- zstyle ':vcs_info:*' unstagedstr '●'
+ zstyle ':vcs_info:*' unstagedstr '±'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
@@ -235,7 +235,7 @@ prompt_status() {
# ends in '-prod'
# - displays black on green otherwise
prompt_aws() {
- [[ -z "$AWS_PROFILE" ]] && return
+ [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
case "$AWS_PROFILE" in
*-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;;
*) prompt_segment green black "AWS: $AWS_PROFILE" ;;
diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme
index a3e77d65d..76c031fd2 100644
--- a/themes/arrow.zsh-theme
+++ b/themes/arrow.zsh-theme
@@ -1,7 +1,7 @@
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
-RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
+RPROMPT='%{$fg[$NCOLOR]%} $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
index 05b3fb212..1e20d8f9f 100644
--- a/themes/avit.zsh-theme
+++ b/themes/avit.zsh-theme
@@ -7,9 +7,9 @@ typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
PROMPT='
$(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
-%{%(!.%F{red}.%F{white})%}▶%{$reset_color%} '
+%{%(!.${fg[red]}.${fg[white]})%}▶%{$reset_color%} '
-PROMPT2='%{%(!.%F{red}.%F{white})%}◀%{$reset_color%} '
+PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} '
RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
@@ -17,7 +17,7 @@ function _user_host() {
local me
if [[ -n $SSH_CONNECTION ]]; then
me="%n@%m"
- elif [[ $LOGNAME != $USER ]]; then
+ elif [[ $LOGNAME != $USERNAME ]]; then
me="%n"
fi
if [[ -n $me ]]; then
diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme
index 1c5d06b2d..85036e4ac 100644
--- a/themes/awesomepanda.zsh-theme
+++ b/themes/awesomepanda.zsh-theme
@@ -1,6 +1,6 @@
# the svn plugin has to be activated for this to work.
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
-PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
+PROMPT='${ret_status}%{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme
index 59a3472b6..e26f786e1 100644
--- a/themes/cloud.zsh-theme
+++ b/themes/cloud.zsh-theme
@@ -2,7 +2,7 @@ if [[ -z $ZSH_THEME_CLOUD_PREFIX ]]; then
ZSH_THEME_CLOUD_PREFIX='☁'
fi
-PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%} %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/edvardm.zsh-theme b/themes/edvardm.zsh-theme
index f9ca1a9e2..d41dd4434 100644
--- a/themes/edvardm.zsh-theme
+++ b/themes/edvardm.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme
index 939bb7a4c..f34f36f8a 100644
--- a/themes/essembeh.zsh-theme
+++ b/themes/essembeh.zsh-theme
@@ -1,24 +1,14 @@
-# Theme with full path names and hostname
-# Handy if you work on different servers all the time;
-
-local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
-
-function my_git_prompt_info() {
- ref=$(git symbolic-ref HEAD 2> /dev/null) || return
- GIT_STATUS=$(git_prompt_status)
- [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS"
- echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
-}
-
-# Colored prompt
-ZSH_THEME_COLOR_USER="green"
-ZSH_THEME_COLOR_HOST="green"
-ZSH_THEME_COLOR_PWD="yellow"
-test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red"
-test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta"
-PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) '
-RPS1="${return_code}"
+# My custom theme:
+# - single line
+# - quite simple by default: user@host:$PWD
+# - green for local shell as non root
+# - red for ssh shell as non root
+# - magenta for root sessions
+# - prefix with remote address for ssh shells
+# - prefix to detect docker containers or chroot
+# - git plugin to display current branch and status
+# git plugin
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
@@ -28,3 +18,33 @@ ZSH_THEME_GIT_PROMPT_RENAMED="~"
ZSH_THEME_GIT_PROMPT_DELETED="!"
ZSH_THEME_GIT_PROMPT_UNMERGED="?"
+function zsh_essembeh_gitstatus {
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+ GIT_STATUS=$(git_prompt_status)
+ if [[ -n $GIT_STATUS ]]; then
+ GIT_STATUS=" $GIT_STATUS"
+ fi
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
+}
+
+# by default, use green for user@host and no prefix
+local ZSH_ESSEMBEH_COLOR="green"
+local ZSH_ESSEMBEH_PREFIX=""
+if [[ -n "$SSH_CONNECTION" ]]; then
+ # display the source address if connected via ssh
+ ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[$(echo $SSH_CONNECTION | awk '{print $1}')]%{$reset_color%} "
+ # use red color to highlight a remote connection
+ ZSH_ESSEMBEH_COLOR="red"
+elif [[ -r /etc/debian_chroot ]]; then
+ # prefix prompt in case of chroot
+ ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} "
+elif [[ -r /.dockerenv ]]; then
+ # also prefix prompt inside a docker contrainer
+ ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} "
+fi
+if [[ $UID = 0 ]]; then
+ # always use magenta for root sessions, even in ssh
+ ZSH_ESSEMBEH_COLOR="magenta"
+fi
+PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(zsh_essembeh_gitstatus)%(!.#.$) '
+RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})"
diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme
index 1d8bb30e1..2523c1776 100644
--- a/themes/fino.zsh-theme
+++ b/themes/fino.zsh-theme
@@ -11,26 +11,35 @@
#
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
+function virtualenv_prompt_info {
+ [[ -n ${VIRTUAL_ENV} ]] || return
+ echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}"
+}
+
function prompt_char {
- git branch >/dev/null 2>/dev/null && echo "±" && return
- echo '○'
+ command git branch &>/dev/null && echo "±" || echo '○'
}
function box_name {
- [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
+ [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
}
-local ruby_env='using%{$FG[243]%} $(ruby_prompt_info)'
+local ruby_env='$(ruby_prompt_info)'
local git_info='$(git_prompt_info)'
+local virtualenv_info='$(virtualenv_prompt_info)'
local prompt_char='$(prompt_char)'
-
-PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}%~%{$reset_color%}${git_info} %{$FG[239]%}${ruby_env}
+PROMPT="╭─${FG[040]}%n ${FG[239]}at ${FG[033]}$(box_name) ${FG[239]}in %B${FG[226]}%~%b${git_info}${ruby_env}${virtualenv_info}
╰─${prompt_char}%{$reset_color%} "
-ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
+ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[239]}on%{$reset_color%} ${FG[255]}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
-ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
-ZSH_THEME_RUBY_PROMPT_PREFIX="‹"
+ZSH_THEME_GIT_PROMPT_DIRTY="${FG[202]}✘✘✘"
+ZSH_THEME_GIT_PROMPT_CLEAN="${FG[040]}✔"
+
+ZSH_THEME_RUBY_PROMPT_PREFIX=" ${FG[239]}using${FG[243]} ‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
+
+export VIRTUAL_ENV_DISABLE_PROMPT=1
+ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[239]}using${FG[243]} «"
+ZSH_THEME_VIRTUALENV_SUFFIX="»%{$reset_color%}"
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme
index 00a60f45b..2b8d559e5 100644
--- a/themes/fishy.zsh-theme
+++ b/themes/fishy.zsh-theme
@@ -1,12 +1,18 @@
# ZSH Theme emulating the Fish shell's default prompt.
_fishy_collapsed_wd() {
- echo $(pwd | perl -pe '
- BEGIN {
- binmode STDIN, ":encoding(UTF-8)";
- binmode STDOUT, ":encoding(UTF-8)";
- }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
-')
+ local i pwd
+ pwd=("${(s:/:)PWD/#$HOME/~}")
+ if (( $#pwd > 1 )); then
+ for i in {1..$(($#pwd-1))}; do
+ if [[ "$pwd[$i]" = .* ]]; then
+ pwd[$i]="${${pwd[$i]}[1,2]}"
+ else
+ pwd[$i]="${${pwd[$i]}[1]}"
+ fi
+ done
+ fi
+ echo "${(j:/:)pwd}"
}
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme
index c0a7fb5d0..e21b52ef5 100644
--- a/themes/flazz.zsh-theme
+++ b/themes/flazz.zsh-theme
@@ -1,4 +1,4 @@
-if [ "$USER" = "root" ]
+if [ "$USERNAME" = "root" ]
then CARETCOLOR="red"
else CARETCOLOR="blue"
fi
diff --git a/themes/fwalch.zsh-theme b/themes/fwalch.zsh-theme
index 24edf55c0..33f851c9d 100644
--- a/themes/fwalch.zsh-theme
+++ b/themes/fwalch.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[green]%} %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme
index e6c2d8142..bb97bfb17 100644
--- a/themes/gallois.zsh-theme
+++ b/themes/gallois.zsh-theme
@@ -1,16 +1,18 @@
# Depends on the git plugin for work_in_progress()
+(( $+functions[work_in_progress] )) || work_in_progress() {}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
-#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
+# Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
- local cb=$(git_current_branch)
- if [ -n "$cb" ]; then
- echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
- fi
+ local branch=$(git_current_branch)
+ [[ -n "$branch" ]] || return 0
+ echo "$(parse_git_dirty)\
+%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\
+${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
# RVM component of prompt
@@ -18,6 +20,5 @@ ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}["
ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}"
# Combine it all into a final right-side prompt
-RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1'
-
+RPS1="\$(git_custom_status)\$(ruby_prompt_info)${RPS1:+ $RPS1}"
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme
index 5f2427c7a..7ac461036 100644
--- a/themes/gentoo.zsh-theme
+++ b/themes/gentoo.zsh-theme
@@ -1,8 +1,28 @@
-function prompt_char {
- if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
+autoload -Uz colors && colors
+
+autoload -Uz vcs_info
+zstyle ':vcs_info:*' check-for-changes true
+zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes
+zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes
+zstyle ':vcs_info:*' actionformats '%F{5}(%F{2}%b%F{3}|%F{1}%a%c%u%m%F{5})%f '
+zstyle ':vcs_info:*' formats '%F{5}(%F{2}%b%c%u%m%F{5})%f '
+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
+zstyle ':vcs_info:*' enable git cvs svn
+zstyle ':vcs_info:git*+set-message:*' hooks untracked-git
+
++vi-untracked-git() {
+ if command git status --porcelain 2>/dev/null | command grep -q '??'; then
+ hook_com[misc]='%F{red}?'
+ else
+ hook_com[misc]=''
+ fi
+}
+
+gentoo_precmd() {
+ vcs_info
}
-PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)$(prompt_char)%{$reset_color%} '
+autoload -U add-zsh-hook
+add-zsh-hook precmd gentoo_precmd
-ZSH_THEME_GIT_PROMPT_PREFIX="("
-ZSH_THEME_GIT_PROMPT_SUFFIX=") "
+PROMPT='%(!.%B%F{red}.%B%F{green}%n@)%m %F{blue}%(!.%1~.%~) ${vcs_info_msg_0_}%F{blue}%(!.#.$)%k%b%f '
diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme
index c6b752e9b..593b8ec35 100644
--- a/themes/gozilla.zsh-theme
+++ b/themes/gozilla.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme
index c79027ed6..c4d785126 100644
--- a/themes/half-life.zsh-theme
+++ b/themes/half-life.zsh-theme
@@ -7,31 +7,22 @@
# git untracked files modification from Brian Carper:
# https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
-function virtualenv_info {
- [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
-}
-PR_GIT_UPDATE=1
-
-setopt prompt_subst
-
-autoload -U add-zsh-hook
-autoload -Uz vcs_info
-
#use extended color palette if available
-if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
- turquoise="%F{81}"
- orange="%F{166}"
- purple="%F{135}"
- hotpink="%F{161}"
- limegreen="%F{118}"
+if [[ $TERM = (*256color|*rxvt*) ]]; then
+ turquoise="%{${(%):-"%F{81}"}%}"
+ orange="%{${(%):-"%F{166}"}%}"
+ purple="%{${(%):-"%F{135}"}%}"
+ hotpink="%{${(%):-"%F{161}"}%}"
+ limegreen="%{${(%):-"%F{118}"}%}"
else
- turquoise="$fg[cyan]"
- orange="$fg[yellow]"
- purple="$fg[magenta]"
- hotpink="$fg[red]"
- limegreen="$fg[green]"
+ turquoise="%{${(%):-"%F{cyan}"}%}"
+ orange="%{${(%):-"%F{yellow}"}%}"
+ purple="%{${(%):-"%F{magenta}"}%}"
+ hotpink="%{${(%):-"%F{red}"}%}"
+ limegreen="%{${(%):-"%F{green}"}%}"
fi
+autoload -Uz vcs_info
# enable VCS systems you use
zstyle ':vcs_info:*' enable git svn
@@ -47,10 +38,10 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true
# %R - repository path
# %S - path in the repository
PR_RST="%{${reset_color}%}"
-FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}"
-FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}"
-FMT_UNSTAGED="%{$orange%} ●"
-FMT_STAGED="%{$limegreen%} ●"
+FMT_BRANCH=" on ${turquoise}%b%u%c${PR_RST}"
+FMT_ACTION=" performing a ${limegreen}%a${PR_RST}"
+FMT_UNSTAGED="${orange} ●"
+FMT_STAGED="${limegreen} ●"
zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
@@ -59,38 +50,44 @@ zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats ""
-function steeef_preexec {
- case "$2" in
- *git*)
- PR_GIT_UPDATE=1
- ;;
- *svn*)
- PR_GIT_UPDATE=1
- ;;
- esac
+function steeef_chpwd {
+ PR_GIT_UPDATE=1
}
-add-zsh-hook preexec steeef_preexec
-function steeef_chpwd {
- PR_GIT_UPDATE=1
+function steeef_preexec {
+ case "$2" in
+ *git*|*svn*) PR_GIT_UPDATE=1 ;;
+ esac
}
-add-zsh-hook chpwd steeef_chpwd
function steeef_precmd {
- if [[ -n "$PR_GIT_UPDATE" ]] ; then
- # check for untracked files or updated submodules, since vcs_info doesn't
- if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
- PR_GIT_UPDATE=1
- FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%} ●${PR_RST}"
- else
- FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}"
- fi
- zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
+ (( PR_GIT_UPDATE )) || return
- vcs_info 'prompt'
- PR_GIT_UPDATE=
- fi
+ # check for untracked files or updated submodules, since vcs_info doesn't
+ if [[ -n "$(git ls-files --other --exclude-standard 2>/dev/null)" ]]; then
+ PR_GIT_UPDATE=1
+ FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${hotpink} ●${PR_RST}"
+ else
+ FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${PR_RST}"
+ fi
+ zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
+
+ vcs_info 'prompt'
+ PR_GIT_UPDATE=
}
+
+# vcs_info running hooks
+PR_GIT_UPDATE=1
+
+autoload -U add-zsh-hook
+add-zsh-hook chpwd steeef_chpwd
add-zsh-hook precmd steeef_precmd
+add-zsh-hook preexec steeef_preexec
+
+# ruby prompt settings
+ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} "
+ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_RVM_PROMPT_OPTIONS="v g"
-PROMPT=$'%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(ruby_prompt_info " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} '
+setopt prompt_subst
+PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "
diff --git a/themes/jbergantine.zsh-theme b/themes/jbergantine.zsh-theme
index d84247cff..8e9a8ee95 100644
--- a/themes/jbergantine.zsh-theme
+++ b/themes/jbergantine.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/jnrowe.zsh-theme b/themes/jnrowe.zsh-theme
index bae88f7ab..9d8fb2488 100644
--- a/themes/jnrowe.zsh-theme
+++ b/themes/jnrowe.zsh-theme
@@ -33,6 +33,6 @@ function {
local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)"
-PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
+PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%} %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
# vim: set ft=zsh ts=4 sw=4 et:
diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme
index 15d77ed23..0f5b16f0a 100644
--- a/themes/jtriley.zsh-theme
+++ b/themes/jtriley.zsh-theme
@@ -1,8 +1,2 @@
-#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d
%{$fg_bold[yellow]%}%% %{$reset_color%}"
-
-#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
-#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
-#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
-#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
diff --git a/themes/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme
index c4720b24d..af96f5e38 100644
--- a/themes/kafeitu.zsh-theme
+++ b/themes/kafeitu.zsh-theme
@@ -1,4 +1,4 @@
-PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%} %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
diff --git a/themes/linuxonly.zsh-theme b/themes/linuxonly.zsh-theme
index f9e0aa07d..2afae8fc3 100644
--- a/themes/linuxonly.zsh-theme
+++ b/themes/linuxonly.zsh-theme
@@ -1,7 +1,6 @@
-# vim: set ts=2 textwidth=0
-
autoload -U add-zsh-hook
autoload -Uz vcs_info
+
local c0=$(printf "\033[0m")
local c1=$(printf "\033[38;5;215m")
local c2=$(printf "\033[38;5;209m")
@@ -13,7 +12,6 @@ local c7=$(printf "\033[38;5;149m")
local c8=$(printf "\033[38;5;126m")
local c9=$(printf "\033[38;5;162m")
-
if [ "$TERM" = "linux" ]; then
c1=$(printf "\033[34;1m")
c2=$(printf "\033[35m")
@@ -26,9 +24,6 @@ if [ "$TERM" = "linux" ]; then
c9=$(printf "\033[34m")
fi
-#local newtv=$(perl $HOME/devel/newtv.pl)
-local newtv=''
-
zstyle ':vcs_info:*' actionformats \
'%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
@@ -42,38 +37,23 @@ prompt_jnrowe_precmd () {
vcs_info
if [ "${vcs_info_msg_0_}" = "" ]; then
- #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f"
- #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/"
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
- #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})"
-
- PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
+ PROMPT='${dir_status} ${ret_status}%{$reset_color%}
> '
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
+${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> '
-
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
-
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
%{$c9%}·>%{$c0%} '
else
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
+${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
> '
-
fi
}
-
-
-#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%}
-#> '
-
-# vim: set ft=zsh ts=4 sw=4 et:
-
-
diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme
new file mode 100644
index 000000000..baff3fb63
--- /dev/null
+++ b/themes/mlh.zsh-theme
@@ -0,0 +1,97 @@
+# The Official Theme of Major League Hacking
+
+## ## ## ## ##
+### ### ## ## ##
+#### #### ## ## ##
+## ### ## ## #########
+## ## ## ## ##
+## ## ## ## ##
+## ## ######## ## ##
+
+# # # # # # # # # # # # # # # # # #
+# # # Feel free to customize! # # #
+# # # # # # # # # # # # # # # # # #
+
+# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables
+# for example in your ~/.zshrc file, like this:
+# MLH_AT_SYMBOL=" at "
+#
+# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file.
+#
+# To easily discover colors and their codes, type `spectrum_ls` in the terminal
+
+# right prompt default settings
+if [ -z "$MLH_PRINT_EXIT_CODE" ]; then
+ MLH_PRINT_EXIT_CODE=true
+fi
+
+if [ -z "$MLH_PRINT_TIME" ]; then
+ MLH_PRINT_TIME=false
+fi
+
+# left prompt symbols default settings
+
+if [ -z "$MLH_AT_SYMBOL" ]; then
+ MLH_AT_SYMBOL="@"
+fi
+
+if [ -z "$MLH_IN_SYMBOL" ]; then
+ MLH_IN_SYMBOL=" in "
+fi
+
+if [ -z "$MLH_ON_SYMBOL" ]; then
+ MLH_ON_SYMBOL=" on "
+fi
+
+if [ -z "$MLH_SHELL_SYMBOL" ]; then
+ MLH_SHELL_SYMBOL="$ "
+fi
+
+# colors
+USER_COLOR="%F{001}"
+DEVICE_COLOR="%F{033}"
+DIR_COLOR="%F{220}"
+BRANCH_COLOR="%F{001}"
+TIME_COLOR="%F{033}"
+
+username() {
+ echo "$USER_COLOR%n%f"
+}
+
+# Prints device name
+device() {
+ echo "$DEVICE_COLOR%m%f"
+}
+
+# Prints the current directory
+directory() {
+ echo "$DIR_COLOR%1~%f"
+}
+
+# Prints current time
+current_time() {
+ if [ "$MLH_PRINT_TIME" = true ]; then
+ echo " $TIME_COLOR%*%f"
+ fi
+}
+
+# Prints exit code of the last executed command
+exit_code() {
+ if [ "$MLH_PRINT_EXIT_CODE" = true ]; then
+ echo "%(?..%F{001}exit %?)%f"
+ fi
+}
+
+prompt_end() {
+ printf "\n$MLH_SHELL_SYMBOL"
+}
+
+# Set git_prompt_info text
+ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%f"
+ZSH_THEME_GIT_PROMPT_DIRTY=""
+ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+# %B and %b make the text bold
+PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)'
+RPROMPT="$(exit_code)$(current_time)"
diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme
index c7cd9ee30..84bee52c3 100644
--- a/themes/muse.zsh-theme
+++ b/themes/muse.zsh-theme
@@ -1,33 +1,16 @@
-#!/usr/bin/env zsh
-#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-
-setopt promptsubst
-
-autoload -U add-zsh-hook
-
-PROMPT_SUCCESS_COLOR=$FG[117]
-PROMPT_FAILURE_COLOR=$FG[124]
-PROMPT_VCS_INFO_COLOR=$FG[242]
-PROMPT_PROMPT=$FG[077]
-GIT_DIRTY_COLOR=$FG[133]
-GIT_CLEAN_COLOR=$FG[118]
-GIT_PROMPT_INFO=$FG[012]
-
-PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} '
-
-#RPS1="${return_code}"
-
-ZSH_THEME_GIT_PROMPT_PREFIX=" ("
-ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})"
-ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
-ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
-
-ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}"
+PROMPT="${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}ᐅ%{$reset_color%} "
+
+ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}("
+ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY=" ${FG[133]}✘"
+ZSH_THEME_GIT_PROMPT_CLEAN=" ${FG[118]}✔"
+
+ZSH_THEME_GIT_PROMPT_ADDED="${FG[082]}✚%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_MODIFIED="${FG[166]}✹%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DELETED="${FG[160]}✖%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_RENAMED="${FG[220]}➜%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_UNMERGED="${FG[082]}═%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_UNTRACKED="${FG[190]}✭%{$reset_color%}"
ZSH_THEME_VIRTUALENV_PREFIX=" ["
ZSH_THEME_VIRTUALENV_SUFFIX="]"
diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme
index 7af44056f..c64362b04 100644
--- a/themes/obraun.zsh-theme
+++ b/themes/obraun.zsh-theme
@@ -1,11 +1,10 @@
-if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
+if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
+PROMPT='%{$fg[green]%}[%D{%H:%M:%S}]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
-
diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme
index b6dfa6870..044534614 100644
--- a/themes/peepcode.zsh-theme
+++ b/themes/peepcode.zsh-theme
@@ -4,11 +4,11 @@
#
git_repo_path() {
- git rev-parse --git-dir 2>/dev/null
+ command git rev-parse --git-dir 2>/dev/null
}
git_commit_id() {
- git rev-parse --short HEAD 2>/dev/null
+ command git rev-parse --short HEAD 2>/dev/null
}
git_mode() {
@@ -22,23 +22,26 @@ git_mode() {
}
git_dirty() {
- if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then
+ if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then
echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
fi
}
git_prompt() {
local cb=$(git_current_branch)
- if [ -n "$cb" ]; then
+ if [[ -n "$cb" ]]; then
local repo_path=$(git_repo_path)
echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
fi
}
-local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
+local smiley='%(?.%F{green}☺%f.%F{red}☹%f)'
PROMPT='
-%~
-${smiley} %{$reset_color%}'
+${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~
+${smiley} '
-RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
+RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
+
+# Disable automatic virtualenv prompt change
+export VIRTUAL_ENV_DISABLE_PROMPT=1
diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme
index 605e3d10c..47b0b4fb1 100644
--- a/themes/pygmalion-virtualenv.zsh-theme
+++ b/themes/pygmalion-virtualenv.zsh-theme
@@ -17,6 +17,8 @@ function _virtualenv_prompt_info {
}
prompt_setup_pygmalion(){
+ setopt localoptions extendedglob
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
@@ -25,16 +27,18 @@ prompt_setup_pygmalion(){
base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
- base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
- post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
+ base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
+ post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
autoload -U add-zsh-hook
add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
+ setopt localoptions extendedglob
+
local gitinfo=$(git_prompt_info)
- local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
+ local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
local prompt_length=${#exp_nocolor}
diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme
index bd58db5f6..b13adfd5f 100644
--- a/themes/pygmalion.zsh-theme
+++ b/themes/pygmalion.zsh-theme
@@ -1,6 +1,8 @@
# Yay! High voltage and arrows!
prompt_setup_pygmalion(){
+ setopt localoptions extendedglob
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
@@ -9,16 +11,18 @@ prompt_setup_pygmalion(){
base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
- base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
- post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
+ base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}}
+ post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}}
autoload -U add-zsh-hook
add-zsh-hook precmd prompt_pygmalion_precmd
}
prompt_pygmalion_precmd(){
+ setopt localoptions extendedglob
+
local gitinfo=$(git_prompt_info)
- local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
+ local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
local prompt_length=${#exp_nocolor}
diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme
index 6cb7cc579..f0b8e5c18 100644
--- a/themes/random.zsh-theme
+++ b/themes/random.zsh-theme
@@ -1,3 +1,10 @@
+# Deprecate ZSH_THEME_RANDOM_BLACKLIST
+if [[ -n "$ZSH_THEME_RANDOM_BLACKLIST" ]]; then
+ echo '[oh-my-zsh] ZSH_THEME_RANDOM_BLACKLIST is deprecated. Use `ZSH_THEME_RANDOM_IGNORED` instead.'
+ ZSH_THEME_RANDOM_IGNORED=($ZSH_THEME_RANDOM_BLACKLIST)
+ unset ZSH_THEME_RANDOM_BLACKLIST
+fi
+
# Make themes a unique array
typeset -Ua themes
@@ -11,8 +18,8 @@ else
"$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r)
"$ZSH"/themes/*.zsh-theme(N:t:r)
)
- # Remove blacklisted themes from the list
- for theme in random ${ZSH_THEME_RANDOM_BLACKLIST[@]}; do
+ # Remove ignored themes from the list
+ for theme in random ${ZSH_THEME_RANDOM_IGNORED[@]}; do
themes=("${(@)themes:#$theme}")
done
fi
@@ -35,4 +42,6 @@ else
return 1
fi
-echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded"
+if [[ -z "$ZSH_THEME_RANDOM_QUIET" ]]; then
+ echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded"
+fi
diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme
index 95af1e2ee..bdf342f49 100644
--- a/themes/re5et.zsh-theme
+++ b/themes/re5et.zsh-theme
@@ -1,4 +1,4 @@
-if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
+if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme
index f2b0526b7..7f54472c6 100644
--- a/themes/smt.zsh-theme
+++ b/themes/smt.zsh-theme
@@ -21,9 +21,9 @@ ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
function prompt_char() {
- git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
- hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
- darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return
+ command git branch &>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
+ command hg root &>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
+ command darcs show repo &>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return
echo "%{$fg[cyan]%}◯%{$reset_color%}"
}
@@ -36,47 +36,44 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
# Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time.
function git_time_since_commit() {
- if git rev-parse --git-dir > /dev/null 2>&1; then
- # Only proceed if there is actually a commit.
- if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
- # Get the last commit.
- last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
- now=`date +%s`
- seconds_since_last_commit=$((now-last_commit))
+ local COLOR MINUTES HOURS DAYS SUB_HOURS SUB_MINUTES
+ local last_commit seconds_since_last_commit
- # Totals
- MINUTES=$((seconds_since_last_commit / 60))
- HOURS=$((seconds_since_last_commit/3600))
+ # Only proceed if there is actually a commit
+ if ! last_commit=$(command git log --pretty=format:'%at' -1 2>/dev/null); then
+ echo "[$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL~%{$reset_color%}]"
+ return
+ fi
- # Sub-hours and sub-minutes
- DAYS=$((seconds_since_last_commit / 86400))
- SUB_HOURS=$((HOURS % 24))
- SUB_MINUTES=$((MINUTES % 60))
+ # Totals
+ seconds_since_last_commit=$(( EPOCHSECONDS - last_commit ))
+ MINUTES=$(( seconds_since_last_commit / 60 ))
+ HOURS=$(( MINUTES / 60 ))
- if [[ -n $(git status -s 2> /dev/null) ]]; then
- if [ "$MINUTES" -gt 30 ]; then
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
- elif [ "$MINUTES" -gt 10 ]; then
- COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
- else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
- fi
- else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
- fi
+ # Sub-hours and sub-minutes
+ DAYS=$(( HOURS / 24 ))
+ SUB_HOURS=$(( HOURS % 24 ))
+ SUB_MINUTES=$(( MINUTES % 60 ))
- if [ "$HOURS" -gt 24 ]; then
- echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
- elif [ "$MINUTES" -gt 60 ]; then
- echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
- else
- echo "[$COLOR${MINUTES}m%{$reset_color%}]"
- fi
+ if [[ -z "$(command git status -s 2>/dev/null)" ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
+ else
+ if [[ "$MINUTES" -gt 30 ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
+ elif [[ "$MINUTES" -gt 10 ]]; then
+ COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
else
- COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
- echo "[$COLOR~]"
+ COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
fi
fi
+
+ if [[ "$HOURS" -gt 24 ]]; then
+ echo "[${COLOR}${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
+ elif [[ "$MINUTES" -gt 60 ]]; then
+ echo "[${COLOR}${HOURS}h${SUB_MINUTES}m%{$reset_color%}]"
+ else
+ echo "[${COLOR}${MINUTES}m%{$reset_color%}]"
+ fi
}
PROMPT='
diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme
index 2111576c3..11f6af127 100644
--- a/themes/sunrise.zsh-theme
+++ b/themes/sunrise.zsh-theme
@@ -9,7 +9,7 @@ Y=$fg_no_bold[yellow]
B=$fg_no_bold[blue]
RESET=$reset_color
-if [ "$USER" = "root" ]; then
+if [ "$USERNAME" = "root" ]; then
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
else
PROMPTCOLOR="" PROMPTPREFIX="---";
diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme
index 144d2549a..4e3238393 100644
--- a/themes/trapd00r.zsh-theme
+++ b/themes/trapd00r.zsh-theme
@@ -2,7 +2,7 @@
#
# This theme needs a terminal supporting 256 colors as well as unicode.
# In order to avoid external dependencies, it also has a zsh version of
-# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path,
+# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path,
# which splits up the current path and makes it fancy.
#
# By default it spans over two lines like so:
@@ -109,23 +109,23 @@ prompt_jnrowe_precmd () {
vcs_info
if [ "${vcs_info_msg_0_}" = "" ]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
- PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
+ PROMPT='${dir_status} ${ret_status}%{$reset_color%}
> '
# modified, to be committed
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
> '
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
%{$c13%}>%{$c0%} '
else
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
PROMPT='${vcs_info_msg_0_}
-%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
+${dir_status}%{$reset_color%}
> '
fi
}
diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
index 89d5355dc..303c898b4 100644
--- a/themes/ys.zsh-theme
+++ b/themes/ys.zsh-theme
@@ -26,15 +26,26 @@ ys_hg_prompt_info() {
if [ -d '.hg' ]; then
echo -n "${YS_VCS_PROMPT_PREFIX1}hg${YS_VCS_PROMPT_PREFIX2}"
echo -n $(hg branch 2>/dev/null)
- if [ -n "$(hg status 2>/dev/null)" ]; then
- echo -n "$YS_VCS_PROMPT_DIRTY"
- else
- echo -n "$YS_VCS_PROMPT_CLEAN"
+ if [[ "$(hg config oh-my-zsh.hide-dirty 2>/dev/null)" != "1" ]]; then
+ if [ -n "$(hg status 2>/dev/null)" ]; then
+ echo -n "$YS_VCS_PROMPT_DIRTY"
+ else
+ echo -n "$YS_VCS_PROMPT_CLEAN"
+ fi
fi
echo -n "$YS_VCS_PROMPT_SUFFIX"
fi
}
+# Virtualenv
+local venv_info='$(virtenv_prompt)'
+YS_THEME_VIRTUALENV_PROMPT_PREFIX=" %{$fg[green]%}"
+YS_THEME_VIRTUALENV_PROMPT_SUFFIX=" %{$reset_color%}%"
+virtenv_prompt() {
+ [[ -n ${VIRTUAL_ENV} ]] || return
+ echo "${YS_THEME_VIRTUALENV_PROMPT_PREFIX}${VIRTUAL_ENV:t}${YS_THEME_VIRTUALENV_PROMPT_SUFFIX}"
+}
+
local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
# Prompt format:
@@ -55,6 +66,7 @@ PROMPT="
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${hg_info}\
${git_info}\
+${venv_info}\
\
%{$fg[white]%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"