themes: change lstheme function to themes in $ZSH_CUSTOM in any level
Also sort and remove duplicates, and pipe to fmt to improve output format.
Fixes #8755
Diff
1diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh
2index 1fbde5b6463565ad2925aad780ac6fbfd25cc18f..cda83f5870ec4c2974428d961dc9a22425e28b19 100644
3--- a/plugins/themes/themes.plugin.zsh
4+++ b/plugins/themes/themes.plugin.zsh
5@@ -23,5 +23,13 @@ function lstheme {
6 # Resources:
7 # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
8 # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Qualifiers
9- print "$ZSH_CUSTOM"/*.zsh-theme(N:t:r) {"$ZSH_CUSTOM","$ZSH"}/themes/*.zsh-theme(N:t:r)
10+ {
11+ # Show themes inside $ZSH_CUSTOM (in any subfolder)
12+ # Strip $ZSH_CUSTOM/themes/ and $ZSH_CUSTOM/ from the name, so that it matches
13+ # the value that should be written in $ZSH_THEME to load the theme.
14+ print -l "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) \
15+
16+ # Show themes inside $ZSH, stripping the head of the path.
17+ print -l "$ZSH"/themes/*.zsh-theme(.N:t:r)
18+ } | sort -u | fmt -w $COLUMNS
19 }