zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: promptinit: only exclude current theme from preview if no arguments are given
@ 2022-02-23 18:54 Mikael Magnusson
  0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2022-02-23 18:54 UTC (permalink / raw)
  To: zsh-workers

Noticed it's actually quite confusing to run
% prompt -p mikachu

and get no output, therefore only exclude the current theme from the
default set, not from explicitly given arguments.

---
 Functions/Prompts/promptinit | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit
index 20503d78b6..0c06699e8c 100644
--- a/Functions/Prompts/promptinit
+++ b/Functions/Prompts/promptinit
@@ -73,7 +73,7 @@ set_prompt() {
 Options:
     -c              Show currently selected theme and parameters
     -l              List currently available prompt themes
-    -p [<themes>]   Preview given themes (defaults to all)
+    -p [<themes>]   Preview given themes (defaults to all except current theme)
     -h [<theme>]    Display help (for given theme)
     -s <theme>      Set and save theme
     <theme>         Switch to new theme immediately (changes not saved)
@@ -120,10 +120,9 @@ Use prompt -h <theme> for help on specific themes.'
        print $prompt_themes
        return
        ;;
-    p) preview=( $prompt_themes )
+    p) preview=( ${prompt_themes:#$prompt_theme} )
        (( $#* > 1 )) && preview=( "$@[2,-1]" )
        for theme in $preview; do
-         [[ "$theme" == "$prompt_theme[*]" ]] && continue
          prompt_preview_safely "$=theme"
        done
        print -P "%b%f%k"
-- 
2.15.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-23 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 18:54 PATCH: promptinit: only exclude current theme from preview if no arguments are given Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).