diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-09-30 15:41:25 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-09-30 15:45:12 +0200 |
commit | 3c209b00d69499db93fb6aac5c79a6179ff6b855 (patch) | |
tree | 8b1ecd90ce42edee1ce46175765167d12fc226e1 | |
parent | 72b8f0b73b56b4a5c01eada3cb93b94be39fd984 (diff) | |
download | zsh-3c209b00d69499db93fb6aac5c79a6179ff6b855.tar.gz zsh-3c209b00d69499db93fb6aac5c79a6179ff6b855.tar.bz2 zsh-3c209b00d69499db93fb6aac5c79a6179ff6b855.zip |
feat(cli): show current theme in `omz theme list`
Fixes #9540
-rw-r--r-- | lib/cli.zsh | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh index f40a4226e..cadc82e27 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -630,17 +630,23 @@ function _omz::theme::list { return fi + # Print theme in use + if [[ -n "$ZSH_THEME" ]]; then + print -Pn "%U%BCurrent theme%b%u: " + [[ $ZSH_THEME = random ]] && echo "$RANDOM_THEME (via random)" || echo "$ZSH_THEME" + echo + fi + + # Print custom themes if there are any if (( ${#custom_themes} )); then print -P "%U%BCustom themes%b%u:" print -l ${(q-)custom_themes} | column -x + echo fi - if (( ${#builtin_themes} )); then - (( ${#custom_themes} )) && echo # add a line of separation - - print -P "%U%BBuilt-in themes%b%u:" - print -l ${(q-)builtin_themes} | column -x - fi + # Print built-in themes + print -P "%U%BBuilt-in themes%b%u:" + print -l ${(q-)builtin_themes} | column -x } function _omz::theme::set { @@ -727,6 +733,10 @@ function _omz::theme::use { _omz::log error "%B$1%b theme not found" return 1 fi + + # Update theme settings + ZSH_THEME="$1" + [[ $1 = random ]] || unset RANDOM_THEME } function _omz::update { |