From f46c1bc11b4bd41be1f6feac61d1944891aa6830 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 19 Apr 2017 17:40:41 -0700 Subject: [PATCH 1/2] Add prompt_opts to prompt setup function --- powerlevel9k.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4d8d1c39..3b8ac49f 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1336,6 +1336,12 @@ prompt_powerlevel9k_setup() { # Maximum integer on 32-bit CPUs _P9K_TIMER_START=2147483647 + prompt_opts=(subst percent) + + # borrowed from promptinit, sets the prompt options in case pure was not + # initialized via promptinit. + setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" + # Display a warning if the terminal does not support 256 colors local term_colors term_colors=$(echotc Co 2>/dev/null) From efac911431c98062cc9d792f08ce70060844c468 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 19 Apr 2017 17:41:08 -0700 Subject: [PATCH 2/2] Stop setting options in prompt setup which are thrown away --- powerlevel9k.zsh-theme | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 3b8ac49f..a718d931 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1336,10 +1336,14 @@ prompt_powerlevel9k_setup() { # Maximum integer on 32-bit CPUs _P9K_TIMER_START=2147483647 + # The prompt function will set these prompt_* options after the setup function + # returns. We need prompt_subst so we can safely run commands in the prompt + # without them being double expanded and we need prompt_percent to expand the + # common percent escape sequences. prompt_opts=(subst percent) - # borrowed from promptinit, sets the prompt options in case pure was not - # initialized via promptinit. + # Borrowed from promptinit, sets the prompt options in case the theme was + # not initialized via promptinit. setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" # Display a warning if the terminal does not support 256 colors @@ -1373,12 +1377,6 @@ prompt_powerlevel9k_setup() { ) print_deprecation_warning deprecated_segments - setopt prompt_subst - - setopt LOCAL_OPTIONS - unsetopt XTRACE KSH_ARRAYS - setopt PROMPT_CR PROMPT_PERCENT PROMPT_SUBST MULTIBYTE - # initialize colors autoload -U colors && colors