From 9e767dd0973113b688067b932998a73016c70eb5 Mon Sep 17 00:00:00 2001 From: caedus75 Date: Wed, 30 Dec 2015 04:23:52 -0200 Subject: [PATCH] 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 --- modules/prompt/themes/gitster.zsh-theme | 5 ++++- modules/prompt/themes/minimal.zsh-theme | 6 +++--- modules/prompt/themes/steeef.zsh-theme | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/prompt/themes/gitster.zsh-theme b/modules/prompt/themes/gitster.zsh-theme index 32a2176..4876cb3 100644 --- a/modules/prompt/themes/gitster.zsh-theme +++ b/modules/prompt/themes/gitster.zsh-theme @@ -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%}" diff --git a/modules/prompt/themes/minimal.zsh-theme b/modules/prompt/themes/minimal.zsh-theme index 914db66..12cd9b3 100644 --- a/modules/prompt/themes/minimal.zsh-theme +++ b/modules/prompt/themes/minimal.zsh-theme @@ -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)' diff --git a/modules/prompt/themes/steeef.zsh-theme b/modules/prompt/themes/steeef.zsh-theme index 9759b31..4a02249 100644 --- a/modules/prompt/themes/steeef.zsh-theme +++ b/modules/prompt/themes/steeef.zsh-theme @@ -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}%} -$ " +$ '