fix prompt substitutions/expansions

The 'prompt' function disables any option set with 'setopt'.
To make options persistent we need to use the 'prompt_opts' array
instead

Closes #8
This commit is contained in:
caedus75 2015-12-30 04:23:52 -02:00 committed by Matt Hamilton
parent 7f0dc26de3
commit f2806b45bf
3 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,9 @@
# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme
#
autoload -Uz colors && colors
prompt_opts=( cr subst percent )
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
function get_pwd(){
@ -20,7 +23,7 @@ function get_pwd(){
print $prompt_short_dir
}
PROMPT="$ret_status %{$fg[white]%}$(get_pwd) $(git_prompt_info)%{$reset_color%}%{$reset_color%} "
PROMPT='$ret_status %{$fg[white]%}$(get_pwd) $(git_prompt_info)%{$reset_color%}%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"

View File

@ -5,7 +5,7 @@
autoload -Uz colors && colors
setopt prompt_subst
prompt_opts=( cr subst percent )
PROMPT_CHAR=""
@ -98,6 +98,6 @@ zle -N zle-line-init
zle -N zle-keymap-select
zle -N zle-line-finish
PROMPT="$(prompt_user)$(prompt_jobs)$(prompt_vimode)$(prompt_status) "
RPROMPT="$(prompt_path)$(prompt_git)"
PROMPT='$(prompt_user)$(prompt_jobs)$(prompt_vimode)$(prompt_status) '
RPROMPT='$(prompt_path)$(prompt_git)'

View File

@ -14,7 +14,7 @@ function virtualenv_info {
}
PR_GIT_UPDATE=1
setopt prompt_subst
prompt_opts=( cr subst percent )
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
@ -96,6 +96,6 @@ function steeef_precmd {
}
add-zsh-hook precmd steeef_precmd
PROMPT="
PROMPT='
%{$purple%}%n${${reset_color}%} at %{$orange%}%m${${reset_color}%} in %{$limegreen%}%~${${reset_color}%} $vcs_info_msg_0_$(virtualenv_info)%{${reset_color}%}
$ "
$ '