summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/agnoster.zsh-theme2
-rw-r--r--themes/fino-time.zsh-theme2
-rw-r--r--themes/muse.zsh-theme43
-rw-r--r--themes/peepcode.zsh-theme19
-rw-r--r--themes/smt.zsh-theme71
5 files changed, 60 insertions, 77 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 89b75aa55..82edd206b 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -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)"
diff --git a/themes/fino-time.zsh-theme b/themes/fino-time.zsh-theme
index d89e25215..57c47db02 100644
--- a/themes/fino-time.zsh-theme
+++ b/themes/fino-time.zsh-theme
@@ -26,7 +26,7 @@ function box_name {
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_prompt_info)\$(ruby_prompt_info) %D - %*
-╰─$(virtualenv_info)$(prompt_char) "
+╰─\$(virtualenv_info)\$(prompt_char) "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
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/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/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='