summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-06-08 20:36:27 +0200
committerMarc Cornellà <marc.cornella@live.com>2020-06-08 20:36:27 +0200
commit374b4e02ef80b14c0d70e99f52ee08cce68a1eeb (patch)
treeecba1f8090629ba863cc769e5cc6cea92f7c2cc4
parente27a6e75cc7314af1a05362aec8bd9568222b43e (diff)
downloadzsh-374b4e02ef80b14c0d70e99f52ee08cce68a1eeb.tar.gz
zsh-374b4e02ef80b14c0d70e99f52ee08cce68a1eeb.tar.bz2
zsh-374b4e02ef80b14c0d70e99f52ee08cce68a1eeb.zip
peepcode: add virtualenv prompt and fix git calls
-rw-r--r--themes/peepcode.zsh-theme19
1 files changed, 11 insertions, 8 deletions
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