3c209b00d69499db93fb6aac5c79a6179ff6b855

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(cli): show current theme in `omz theme list`

Fixes #9540

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index f40a4226e61e95b5a42f36d7ae1799af69947635..cadc82e27e9cbdb2d792bed535b0655ff460243e 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -630,17 +630,23 @@ function _omz::theme::list {
 6     return
 7   fi
 8 
 9+  # Print theme in use
10+  if [[ -n "$ZSH_THEME" ]]; then
11+    print -Pn "%U%BCurrent theme%b%u: "
12+    [[ $ZSH_THEME = random ]] && echo "$RANDOM_THEME (via random)" || echo "$ZSH_THEME"
13+    echo
14+  fi
15+
16+  # Print custom themes if there are any
17   if (( ${#custom_themes} )); then
18     print -P "%U%BCustom themes%b%u:"
19     print -l ${(q-)custom_themes} | column -x
20+    echo
21   fi
22 
23-  if (( ${#builtin_themes} )); then
24-    (( ${#custom_themes} )) && echo # add a line of separation
25-
26-    print -P "%U%BBuilt-in themes%b%u:"
27-    print -l ${(q-)builtin_themes} | column -x
28-  fi
29+  # Print built-in themes
30+  print -P "%U%BBuilt-in themes%b%u:"
31+  print -l ${(q-)builtin_themes} | column -x
32 }
33 
34 function _omz::theme::set {
35@@ -727,6 +733,10 @@ function _omz::theme::use {
36     _omz::log error "%B$1%b theme not found"
37     return 1
38   fi
39+
40+  # Update theme settings
41+  ZSH_THEME="$1"
42+  [[ $1 = random ]] || unset RANDOM_THEME
43 }
44 
45 function _omz::update {