summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/adben.zsh-theme106
-rw-r--r--themes/af-magic.zsh-theme63
-rw-r--r--themes/afowler.zsh-theme14
-rw-r--r--themes/aussiegeek.zsh-theme2
-rw-r--r--themes/bira.zsh-theme28
-rw-r--r--themes/dallas.zsh-theme2
-rw-r--r--themes/emotty.zsh-theme6
-rw-r--r--themes/essembeh.zsh-theme2
-rw-r--r--themes/jonathan.zsh-theme261
-rw-r--r--themes/josh.zsh-theme4
-rw-r--r--themes/minimal.zsh-theme32
-rw-r--r--themes/murilasso.zsh-theme2
-rw-r--r--themes/nicoulaj.zsh-theme2
-rw-r--r--themes/pygmalion-virtualenv.zsh-theme11
-rw-r--r--themes/pygmalion.zsh-theme6
-rw-r--r--themes/refined.zsh-theme5
-rw-r--r--themes/simonoff.zsh-theme187
-rw-r--r--themes/ys.zsh-theme10
18 files changed, 334 insertions, 409 deletions
diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
index ebdec7c82..c2fdbed23 100644
--- a/themes/adben.zsh-theme
+++ b/themes/adben.zsh-theme
@@ -32,42 +32,44 @@
########## 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}]%}'
+ typeset -g PR_$COLOR="%b%{$fg[${(L)COLOR}]%}"
+ typeset -g PR_BRIGHT_$COLOR="%B%{$fg[${(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} "
-GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} "
-GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}"
-GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} "
-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}"
+
+RED_START="${PR_GREY}<${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} "
+RED_END="${PR_BRIGHT_RED}>${PR_RED}>${PR_GREY}>${PR_RESET} "
+GREEN_START="${PR_GREY}>${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}"
+GREEN_END="${PR_BRIGHT_GREEN}>${PR_GREEN}>${PR_GREY}>${PR_RESET} "
+
+########## VCS ###########
+VCS_DIRTY_COLOR="${PR_YELLOW}"
+VCS_CLEAN_COLOR="${PR_GREEN}"
+VCS_SUFFIX_COLOR="${PR_RED}› ${PR_RESET}"
########## 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}"
+ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RED}‹svn:"
+ZSH_THEME_SVN_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}"
+ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘"
+ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔"
########## 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}"
-ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
-ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}"
-ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}"
-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}"
+ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RED}‹git:"
+ZSH_THEME_GIT_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}"
+ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘"
+ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔"
+ZSH_THEME_GIT_PROMPT_ADDED="${PR_YELLOW} ✚"
+ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_YELLOW} ✹"
+ZSH_THEME_GIT_PROMPT_DELETED="${PR_YELLOW} ✖"
+ZSH_THEME_GIT_PROMPT_RENAMED="${PR_YELLOW} ➜"
+ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_YELLOW} ═"
+ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_YELLOW} ✭"
# Get a fortune quote
ps1_fortune() {
- (( ${+commands[fortune]} )) && fortune
+ if (( ${+commands[fortune]} )); then
+ fortune
+ fi
}
# Obtain a command tip
@@ -77,33 +79,27 @@ ps1_command_tip() {
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'
+ fi
+ } | sed '1d;/^$/d'
}
-function precmd_adben {
- prompt_header() {
- if [[ "$ENABLE_COMMAND_TIP" = true ]]; then
- ps1_command_tip
- else
- ps1_fortune
- fi
- }
+# Show prompt header (fortune / command tip)
+prompt_header() {
+ local header=$(
+ case "${ENABLE_COMMAND_TIP:-}" in
+ true) ps1_command_tip ;;
+ *) ps1_fortune ;;
+ esac
+ )
- 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
+ # Make sure to quote % so that they're not expanded by the prompt
+ echo -n "${header:gs/%/%%}"
}
# 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}"
+ echo -n "${PR_RESET}${PR_RED}%n@%m"
fi
}
@@ -111,16 +107,12 @@ prompt_context() {
# 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}'
+# Prompt: header, context (user@host), directory
+PROMPT="${RED_START}${PR_YELLOW}\$(prompt_header)${PR_RESET}
+${RED_START}\$(prompt_context)${PR_BRIGHT_YELLOW}%~${PR_RESET}
+${GREEN_START} "
+# Right prompt: vcs status + time
+RPROMPT="\$(git_prompt_info)\$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}"
# Matching continuation prompt
-PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
-
-# Prompt head
-autoload -Uz add-zsh-hook
-add-zsh-hook precmd precmd_adben
+PROMPT2="${GREEN_START} %_ ${GREEN_START} "
diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme
index 1d2af3458..d939d546f 100644
--- a/themes/af-magic.zsh-theme
+++ b/themes/af-magic.zsh-theme
@@ -1,47 +1,46 @@
# af-magic.zsh-theme
-# Repo: https://github.com/andyfleming/oh-my-zsh
-# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
+#
+# Author: Andy Fleming
+# URL: http://andyfleming.com/
-
-# settings
-typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-typeset +H my_gray="$FG[237]"
-typeset +H my_orange="$FG[214]"
-
-# separator dashes size
+# dashed separator size
function afmagic_dashes {
- local PYTHON_ENV="$VIRTUAL_ENV"
- [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV"
-
- if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then
- echo $(( COLUMNS - ${#PYTHON_ENV} - 3 ))
- else
- echo $COLUMNS
- fi
+ # check either virtualenv or condaenv variables
+ local python_env="${VIRTUAL_ENV:-$CONDA_DEFAULT_ENV}"
+
+ # if there is a python virtual environment and it is displayed in
+ # the prompt, account for it when returning the number of dashes
+ if [[ -n "$python_env" && "$PS1" = \(* ]]; then
+ echo $(( COLUMNS - ${#python_env} - 3 ))
+ else
+ echo $COLUMNS
+ fi
}
-# primary prompt
-PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%}
-$FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} '
-PS2='%{$fg[red]%}\ %{$reset_color%}'
-RPS1='${return_code}'
+# primary prompt: dashed separator, directory and vcs info
+PS1="${FG[237]}\${(l.\$(afmagic_dashes)..-.)}%{$reset_color%}
+${FG[032]}%~\$(git_prompt_info)\$(hg_prompt_info) ${FG[105]}%(!.#.»)%{$reset_color%} "
+PS2="%{$fg[red]%}\ %{$reset_color%}"
-# right prompt
-(( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)'
-RPS1+=' $my_gray%n@%m%{$reset_color%}%'
+# right prompt: return code, virtualenv and context (user@host)
+RPS1="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+if (( $+functions[virtualenv_prompt_info] )); then
+ RPS1+='$(virtualenv_prompt_info)'
+fi
+RPS1+=" ${FG[237]}%n@%m%{$reset_color%}"
# git settings
-ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
+ZSH_THEME_GIT_PROMPT_PREFIX="${FG[075]}(${FG[078]}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
-ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
-ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}"
# hg settings
-ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
+ZSH_THEME_HG_PROMPT_PREFIX="${FG[075]}(${FG[078]}"
ZSH_THEME_HG_PROMPT_CLEAN=""
-ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
-ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}"
# virtualenv settings
-ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075]["
+ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[075]}["
ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}"
diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme
index 3a4753fc1..f6d3ef82a 100644
--- a/themes/afowler.zsh-theme
+++ b/themes/afowler.zsh-theme
@@ -1,10 +1,10 @@
-if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
-
-local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
-
-PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
-
-RPS1="${return_code}"
+PROMPT='%m %B%F{blue}:: %b%F{green}%3~ $(hg_prompt_info)$(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b '
+RPS1='%(?..%F{red}%? ↵%f)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+
+ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[magenta]%}hg:‹%{$fg[yellow]%}"
+ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[magenta]%}› %{$reset_color%}"
+ZSH_THEME_HG_PROMPT_DIRTY=" %{$fg[red]%}✗"
+ZSH_THEME_HG_PROMPT_CLEAN=""
diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek.zsh-theme
index c2c7f65b9..2ded5c157 100644
--- a/themes/aussiegeek.zsh-theme
+++ b/themes/aussiegeek.zsh-theme
@@ -1,5 +1,5 @@
-PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color
+PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(ruby_prompt_info)$fg_bold[blue] ]$reset_color
$ '
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green]("
diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
index cdae68d6c..42a70a018 100644
--- a/themes/bira.zsh-theme
+++ b/themes/bira.zsh-theme
@@ -1,32 +1,32 @@
-# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} "
+local user_symbol='%(!.#.$)'
+local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
-if [[ $UID -eq 0 ]]; then
- local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
- local user_symbol='#'
-else
- local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}'
- local user_symbol='$'
-fi
-
-local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
-local git_branch='$(git_prompt_info)'
+local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
local rvm_ruby='$(ruby_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
-PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
+PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
╰─%B${user_symbol}%b "
RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}"
+
+ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
+ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
+ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
-ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
-ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
+ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX"
+ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"
diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme
index d6c417fc3..4f8be20d3 100644
--- a/themes/dallas.zsh-theme
+++ b/themes/dallas.zsh-theme
@@ -9,7 +9,7 @@ DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)"
# Grab the current username: dallas
DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}"
-# Use a % for normal users and a # for privelaged (root) users.
+# Use a % for normal users and a # for privileged (root) users.
DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}"
# For the git prompt, use a white @ and blue text for the branch name
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}"
diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme
index 13adad78d..044b317e8 100644
--- a/themes/emotty.zsh-theme
+++ b/themes/emotty.zsh-theme
@@ -51,9 +51,9 @@ root_prompt="$emoji[skull]"
warn_prompt="$emoji[collision_symbol]"
vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}"
-vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}"
-vcs_branch_glyph=$(print -P $'\Ue0a0') # 
-vcs_action_glyph=$(print -P $'\U276f') # ❯
+vcs_staged_glyph="%{$emoji[high_voltage_sign]%2G%}"
+vcs_branch_glyph=$'\Ue0a0' # 
+vcs_action_glyph=$'\U276f' # ❯
red="$FG[001]"
yellow="$FG[003]"
diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme
index f34f36f8a..43d4093b1 100644
--- a/themes/essembeh.zsh-theme
+++ b/themes/essembeh.zsh-theme
@@ -39,7 +39,7 @@ 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
+ # also prefix prompt inside a docker container
ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} "
fi
if [[ $UID = 0 ]]; then
diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
index 2f0e77431..11d799a84 100644
--- a/themes/jonathan.zsh-theme
+++ b/themes/jonathan.zsh-theme
@@ -1,153 +1,124 @@
-functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){}
-
function theme_precmd {
- local TERMWIDTH
- (( TERMWIDTH = ${COLUMNS} - 1 ))
-
-
- ###
- # Truncate the path if it's too long.
-
- PR_FILLBAR=""
- PR_PWDLEN=""
-
- local promptsize=${#${(%):---(%n@%m:%l)---()--}}
- local rubyprompt=`rvm_prompt_info || rbenv_prompt_info`
- local rubypromptsize=${#${rubyprompt}}
- local pwdsize=${#${(%):-%~}}
-
- if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
- ((PR_PWDLEN=$TERMWIDTH - $promptsize))
- else
- PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}"
- fi
-
+ local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} ))
+
+ PR_FILLBAR=""
+ PR_PWDLEN=""
+
+ local promptsize=${#${(%):---(%n@%m:%l)---()--}}
+ local rubypromptsize=${#${(%)$(ruby_prompt_info)}}
+ local pwdsize=${#${(%):-%~}}
+
+ # Truncate the path if it's too long.
+ if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then
+ (( PR_PWDLEN = TERMWIDTH - promptsize ))
+ elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
+ PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}"
+ else
+ PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}"
+ fi
}
-
-setopt extended_glob
-theme_preexec () {
- if [[ "$TERM" == "screen" ]]; then
- local CMD=${1[(wr)^(*=*|sudo|-*)]}
- echo -n "\ek$CMD\e\\"
- fi
-}
-
-
-setprompt () {
- ###
- # Need this so the prompt will work.
-
- setopt prompt_subst
-
-
- ###
- # See if we can use colors.
-
- autoload zsh/terminfo
- for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
- eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
- eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
- (( count = $count + 1 ))
- done
- PR_NO_COLOUR="%{$terminfo[sgr0]%}"
-
- ###
- # Modify Git prompt
- ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
- ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
- ZSH_THEME_GIT_PROMPT_DIRTY=""
- ZSH_THEME_GIT_PROMPT_CLEAN=""
-
- ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
- ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
- ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
- ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
- ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
- ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
-
- ###
- # See if we can use extended characters to look nicer.
- # UTF-8 Fixed
-
- if [[ $(locale charmap) == "UTF-8" ]]; then
- PR_SET_CHARSET=""
- PR_SHIFT_IN=""
- PR_SHIFT_OUT=""
- PR_HBAR="─"
- PR_ULCORNER="┌"
- PR_LLCORNER="└"
- PR_LRCORNER="┘"
- PR_URCORNER="┐"
- else
- typeset -A altchar
- set -A altchar ${(s..)terminfo[acsc]}
- # Some stuff to help us draw nice lines
- PR_SET_CHARSET="%{$terminfo[enacs]%}"
- PR_SHIFT_IN="%{$terminfo[smacs]%}"
- PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
- PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT'
- PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT'
- PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT'
- PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT'
- PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT'
- fi
-
-
- ###
- # Decide if we need to set titlebar text.
-
- case $TERM in
- xterm*)
- PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
- ;;
- screen)
- PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
- ;;
- *)
- PR_TITLEBAR=''
- ;;
- esac
-
-
- ###
- # Decide whether to set a screen title
- if [[ "$TERM" == "screen" ]]; then
- PR_STITLE=$'%{\ekzsh\e\\%}'
- else
- PR_STITLE=''
- fi
-
-
- ###
- # Finally, the prompt.
-
- PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
-$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\
-$PR_GREEN%$PR_PWDLEN<...<%~%<<\
-$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\
-$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
-$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\
-
-$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\
-$PR_YELLOW%D{%H:%M:%S}\
-$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\
-$PR_HBAR\
->$PR_NO_COLOUR '
-
- # display exitcode on the right when >0
- return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
- RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\
-($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR'
-
- PS2='$PR_CYAN$PR_HBAR\
-$PR_BLUE$PR_HBAR(\
-$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\
-$PR_CYAN$PR_HBAR$PR_NO_COLOUR '
+function theme_preexec {
+ setopt local_options extended_glob
+ if [[ "$TERM" = "screen" ]]; then
+ local CMD=${1[(wr)^(*=*|sudo|-*)]}
+ echo -n "\ek$CMD\e\\"
+ fi
}
-setprompt
-
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
add-zsh-hook preexec theme_preexec
+
+
+# Set the prompt
+
+# Need this so the prompt will work.
+setopt prompt_subst
+
+# See if we can use colors.
+autoload zsh/terminfo
+for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
+ typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}"
+ typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}"
+done
+PR_NO_COLOUR="%{$terminfo[sgr0]%}"
+
+# Modify Git prompt
+ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY=""
+ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} %{%G✚%}"
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} %{%G✹%}"
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} %{%G✖%}"
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} %{%G➜%}"
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} %{%G═%}"
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}"
+
+# Use extended characters to look nicer if supported.
+if [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
+ PR_SET_CHARSET=""
+ PR_HBAR="─"
+ PR_ULCORNER="┌"
+ PR_LLCORNER="└"
+ PR_LRCORNER="┘"
+ PR_URCORNER="┐"
+else
+ typeset -A altchar
+ set -A altchar ${(s..)terminfo[acsc]}
+ # Some stuff to help us draw nice lines
+ PR_SET_CHARSET="%{$terminfo[enacs]%}"
+ PR_SHIFT_IN="%{$terminfo[smacs]%}"
+ PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
+ PR_HBAR="${PR_SHIFT_IN}${altchar[q]:--}${PR_SHIFT_OUT}"
+ PR_ULCORNER="${PR_SHIFT_IN}${altchar[l]:--}${PR_SHIFT_OUT}"
+ PR_LLCORNER="${PR_SHIFT_IN}${altchar[m]:--}${PR_SHIFT_OUT}"
+ PR_LRCORNER="${PR_SHIFT_IN}${altchar[j]:--}${PR_SHIFT_OUT}"
+ PR_URCORNER="${PR_SHIFT_IN}${altchar[k]:--}${PR_SHIFT_OUT}"
+fi
+
+# Decide if we need to set titlebar text.
+case $TERM in
+ xterm*)
+ PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
+ ;;
+ screen)
+ PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
+ ;;
+ *)
+ PR_TITLEBAR=""
+ ;;
+esac
+
+# Decide whether to set a screen title
+if [[ "$TERM" = "screen" ]]; then
+ PR_STITLE=$'%{\ekzsh\e\\%}'
+else
+ PR_STITLE=""
+fi
+
+# Finally, the prompt.
+PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\
+${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\
+${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\
+${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\
+${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\
+${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\
+
+${PR_CYAN}${PR_LLCORNER}${PR_BLUE}${PR_HBAR}(\
+${PR_YELLOW}%D{%H:%M:%S}\
+${PR_LIGHT_BLUE}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)${PR_BLUE})${PR_CYAN}${PR_HBAR}\
+${PR_HBAR}\
+>${PR_NO_COLOUR} '
+
+# display exitcode on the right when > 0
+return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
+RPROMPT=' $return_code${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}\
+(${PR_YELLOW}%D{%a,%b%d}${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_LRCORNER}${PR_NO_COLOUR}'
+
+PS2='${PR_CYAN}${PR_HBAR}\
+${PR_BLUE}${PR_HBAR}(\
+${PR_LIGHT_GREEN}%_${PR_BLUE})${PR_HBAR}\
+${PR_CYAN}${PR_HBAR}${PR_NO_COLOUR} '
diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme
index c8f0f4dd7..ea051c58e 100644
--- a/themes/josh.zsh-theme
+++ b/themes/josh.zsh-theme
@@ -10,7 +10,7 @@ function josh_prompt {
prompt=" "
branch=$(git_current_branch)
- ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
+ ruby_version=$(ruby_prompt_info)
path_size=${#PWD}
branch_size=${#branch}
ruby_size=${#ruby_version}
@@ -31,7 +31,7 @@ function josh_prompt {
prompt=" $prompt"
done
- prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)"
+ prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} $(git_current_branch)"
echo $prompt
}
diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme
index e05df9c9b..588ab6982 100644
--- a/themes/minimal.zsh-theme
+++ b/themes/minimal.zsh-theme
@@ -2,23 +2,25 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} "
-ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
-ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
-ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
-ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
-ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
-ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
-ZSH_THEME_HG_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
-ZSH_THEME_HG_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
+
+ZSH_THEME_SVN_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
+ZSH_THEME_SVN_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ZSH_THEME_SVN_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
+ZSH_THEME_SVN_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
+
+ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
+ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
+ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
vcs_status() {
- if [[ $(whence in_svn) != "" ]] && in_svn; then
- svn_prompt_info
- elif [[ $(whence in_hg) != "" ]] && in_hg; then
- hg_prompt_info
- else
- git_prompt_info
- fi
+ if (( ${+functions[in_svn]} )) && in_svn; then
+ svn_prompt_info
+ elif (( ${+functions[in_hg]} )) && in_hg; then
+ hg_prompt_info
+ else
+ git_prompt_info
+ fi
}
PROMPT='%2~ $(vcs_status)»%b '
diff --git a/themes/murilasso.zsh-theme b/themes/murilasso.zsh-theme
index bc2b9b224..d46874c54 100644
--- a/themes/murilasso.zsh-theme
+++ b/themes/murilasso.zsh-theme
@@ -1,7 +1,7 @@
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
-local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}'
+local rvm_ruby='%{$fg[red]%}$(ruby_prompt_info)%{$reset_color%}'
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme
index 333aa5e70..685cd1ade 100644
--- a/themes/nicoulaj.zsh-theme
+++ b/themes/nicoulaj.zsh-theme
@@ -6,7 +6,7 @@
# * Only shows the path on the left prompt by default.
# * Crops the path to a defined length and only shows the path relative to
# the current VCS repository root.
-# * Wears a different color wether the last command succeeded/failed.
+# * Wears a different color whether the last command succeeded/failed.
# * Shows user@hostname if connected through SSH.
# * Shows if logged in as root or not.
# ------------------------------------------------------------------------------
diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme
index 47b0b4fb1..c2ab7f4e6 100644
--- a/themes/pygmalion-virtualenv.zsh-theme
+++ b/themes/pygmalion-virtualenv.zsh-theme
@@ -35,19 +35,20 @@ prompt_setup_pygmalion(){
}
prompt_pygmalion_precmd(){
- setopt localoptions extendedglob
+ setopt localoptions nopromptsubst extendedglob
local gitinfo=$(git_prompt_info)
local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
- local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
+ local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")"
local prompt_length=${#exp_nocolor}
+ # add new line on prompt longer than 40 characters
local nl=""
-
if [[ $prompt_length -gt 40 ]]; then
- nl=$'\n%{\r%}';
+ nl=$'\n%{\r%}'
fi
- PROMPT="$base_prompt$gitinfo$nl$post_prompt"
+
+ PROMPT="${base_prompt}\$(git_prompt_info)${nl}${post_prompt}"
}
prompt_setup_pygmalion
diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme
index b13adfd5f..be9ca3889 100644
--- a/themes/pygmalion.zsh-theme
+++ b/themes/pygmalion.zsh-theme
@@ -19,14 +19,14 @@ prompt_setup_pygmalion(){
}
prompt_pygmalion_precmd(){
- setopt localoptions extendedglob
+ setopt localoptions nopromptsubst extendedglob
local gitinfo=$(git_prompt_info)
local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}}
- local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
+ local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")"
local prompt_length=${#exp_nocolor}
- PROMPT="${base_prompt}${gitinfo}${post_prompt}"
+ PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}"
}
prompt_setup_pygmalion
diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme
index 2a4188c9d..5e2de7a87 100644
--- a/themes/refined.zsh-theme
+++ b/themes/refined.zsh-theme
@@ -33,8 +33,8 @@ autoload -Uz vcs_info
zstyle ':vcs_info:*' enable hg bzr git
zstyle ':vcs_info:*:*' unstagedstr '!'
zstyle ':vcs_info:*:*' stagedstr '+'
-zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c"
-zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)"
+zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%%u%c"
+zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%u%c (%a)"
zstyle ':vcs_info:*:*' nvcsformats "%~" "" ""
# Fastest possible way to check if repo is dirty
@@ -70,6 +70,7 @@ preexec() {
# Output additional information about paths, repos and exec time
#
precmd() {
+ setopt localoptions nopromptsubst
vcs_info # Get version control info before we start outputting stuff
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
unset cmd_timestamp #Reset cmd exec time.
diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme
index ef91c5ee3..287781d9e 100644
--- a/themes/simonoff.zsh-theme
+++ b/themes/simonoff.zsh-theme
@@ -1,130 +1,95 @@
-# Prompt
-#
-# Below are the color init strings for the basic file types. A color init
-# string consists of one or more of the following numeric codes:
-# Attribute codes:
-# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
-# Text color codes:
-# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
-# Background color codes:
-# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
-function precmd {
-
- local TERMWIDTH
- (( TERMWIDTH = ${COLUMNS} - 1 ))
-
-
- ###
- # Truncate the path if it's too long.
-
- PR_FILLBAR=""
- PR_PWDLEN=""
-
- local promptsize=${#${(%):---(%n@%M:%l)---()}}
- local pwdsize=${#${(%):-%~}}
- local gitbranch="$(git_prompt_info)"
- local rvmprompt="$(ruby_prompt_info)"
- local gitbranchsize=${#${gitbranch:-''}}
- local rvmpromptsize=${#${rvmprompt:-''}}
-
- if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then
- ((PR_PWDLEN=$TERMWIDTH - $promptsize))
- else
- PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}"
- fi
+function theme_precmd {
+ PR_FILLBAR=""
+ PR_PWDLEN=""
+
+ local promptsize=${#${(%):--(%n@%M:)--(%l)-}}
+ local pwdsize=${#${(%):-%~}}
+ local gitbranchsize="${#${(%)$(git_prompt_info)}:-}"
+ local rvmpromptsize="${#${(%)$(ruby_prompt_info):-}}"
+
+ # Truncate the path if it's too long.
+ if (( promptsize + pwdsize + rvmpromptsize + gitbranchsize > COLUMNS )); then
+ (( PR_PWDLEN = COLUMNS - promptsize ))
+ else
+ PR_FILLBAR="\${(l.$(( COLUMNS - (promptsize + pwdsize + rvmpromptsize + gitbranchsize) ))..${PR_SPACE}.)}"
+ fi
}
+function theme_preexec {
+ setopt local_options extended_glob
+ if [[ "$TERM" == "screen" ]]; then
+ local CMD=${1[(wr)^(*=*|sudo|-*)]}
+ echo -n "\ek$CMD\e\\"
+ fi
-setopt extended_glob
+ if [[ "$TERM" == "xterm" ]]; then
+ print -Pn "\e]0;$1\a"
+ fi
-preexec () {
- if [[ "$TERM" == "screen" ]]; then
- local CMD=${1[(wr)^(*=*|sudo|-*)]}
- echo -n "\ek$CMD\e\\"
- fi
-
- if [[ "$TERM" == "xterm" ]]; then
- print -Pn "\e]0;$1\a"
- fi
-
- if [[ "$TERM" == "rxvt" ]]; then
- print -Pn "\e]0;$1\a"
- fi
+ if [[ "$TERM" == "rxvt" ]]; then
+ print -Pn "\e]0;$1\a"
+ fi
}
-setprompt () {
-###
-# Need this so the prompt will work.
+autoload -U add-zsh-hook
+add-zsh-hook precmd theme_precmd
+add-zsh-hook preexec theme_preexec
- setopt prompt_subst
+# Set the prompt
+
+# Need this so the prompt will work.
+setopt prompt_subst
-###
# See if we can use colors.
+autoload zsh/terminfo
+for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
+ typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}"
+ typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}"
+done
+PR_NO_COLOUR="%{$terminfo[sgr0]%}"
+
+# Use extended characters to look nicer
+PR_HBAR="-"
+PR_ULCORNER="-"
+PR_LLCORNER="-"
+PR_LRCORNER="-"
+PR_URCORNER="-"
+
+# Modify Git prompt
+ZSH_THEME_GIT_PROMPT_PREFIX=" ["
+ZSH_THEME_GIT_PROMPT_SUFFIX="]"
+
+# Modify RVM prompt
+ZSH_THEME_RUBY_PROMPT_PREFIX=" ["
+ZSH_THEME_RUBY_PROMPT_SUFFIX="]"
- autoload zsh/terminfo
- for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
- eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
- eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
- (( count = $count + 1 ))
- done
- PR_NO_COLOUR="%{$terminfo[sgr0]%}"
-
-
-###
-# See if we can use extended characters to look nicer.
-
- typeset -A altchar
-# set -A altchar "${(s..)terminfo[acsc]}"
- PR_SET_CHARSET="%{$terminfo[enacs]%}"
- PR_HBAR=${altchar[q]:--}
- PR_ULCORNER=${altchar[l]:--}
- PR_LLCORNER=${altchar[m]:--}
- PR_LRCORNER=${altchar[j]:--}
- PR_URCORNER=${altchar[k]:--}
-
- ###
- # Modify Git prompt
- ZSH_THEME_GIT_PROMPT_PREFIX=" ["
- ZSH_THEME_GIT_PROMPT_SUFFIX="]"
- ###
- # Modify RVM prompt
- ZSH_THEME_RUBY_PROMPT_PREFIX=" ["
- ZSH_THEME_RUBY_PROMPT_SUFFIX="]"
-
-
-###
# Decide if we need to set titlebar text.
+case $TERM in
+ xterm*|*rxvt*)
+ PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(ruby_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}'
+ ;;
+ screen)
+ PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
+ ;;
+ *)
+ PR_TITLEBAR=""
+ ;;
+esac
- case $TERM in
- xterm*|*rxvt*)
- PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}'
- ;;
- screen)
- PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
- ;;
- *)
- PR_TITLEBAR=''
- ;;
- esac
-
-
-###
# Decide whether to set a screen title
- if [[ "$TERM" == "screen" ]]; then
- PR_STITLE=$'%{\ekzsh\e\\%}'
- else
- PR_STITLE=''
- fi
+if [[ "$TERM" == "screen" ]]; then
+ PR_STITLE=$'%{\ekzsh\e\\%}'
+else
+ PR_STITLE=""
+fi
-###
# Finally, the prompt.
-#
- PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
+PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
$PR_RED$PR_HBAR<\
-$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\
-$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\
+$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(ruby_prompt_info)\
+$PR_RED>$PR_HBAR${(e)PR_FILLBAR}\
$PR_RED$PR_HBAR<\
$PR_GREEN%l$PR_RED>$PR_HBAR\
@@ -132,7 +97,3 @@ $PR_RED$PR_HBAR<\
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\
$PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\
$PR_NO_COLOUR '
-
-}
-
-setprompt
diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
index 251b48827..45bbae2d1 100644
--- a/themes/ys.zsh-theme
+++ b/themes/ys.zsh-theme
@@ -5,10 +5,8 @@
#
# Mar 2013 Yad Smood
-typeset +H my_gray="$FG[247]"
-
# VCS
-YS_VCS_PROMPT_PREFIX1=" %{$my_gray%}on%{$reset_color%} "
+YS_VCS_PROMPT_PREFIX1=" %{$reset_color%}on%{$fg[blue]%} "
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
@@ -62,13 +60,13 @@ local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
-%{$my_gray%}@ \
+%{$reset_color%}@ \
%{$fg[green]%}%m \
-%{$my_gray%}in \
+%{$reset_color%}in \
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${hg_info}\
${git_info}\
${venv_info}\
\
-%{$my_gray%}[%*] $exit_code
+[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"