|
@@ -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%} "
|