fish_config theme show: list default scheme first

Webconfig does the same ("Add the current scheme first, then the
default.").
This commit is contained in:
Johannes Altmanninger
2025-11-25 12:52:39 +01:00
parent d8f1a2a24f
commit 707bfe3ce6
2 changed files with 10 additions and 2 deletions

View File

@@ -3,7 +3,15 @@
function __fish_theme_for_each
set -l callback $argv[1]
set -l theme_names $argv[2..]
for theme_name in (__fish_theme_names $theme_names)
for theme_name in (
set -l matching_names (__fish_theme_names $theme_names)
if not set -q theme_names[1]
echo default
string match -v -- default $matching_names
else
string join -- \n $matching_names
end
)
set -l theme_data (__fish_theme_cat $theme_name)
$callback \
--name=$theme_name \

View File

@@ -149,11 +149,11 @@ fish_config theme show ayu-dark ayu-light | string match -r '^.*ayu.*'
mkdir $__fish_config_dir/themes
touch $__fish_config_dir/themes/custom-from-userconf.theme
fish_config theme show | grep -E '[^-]default|base16-default-dark|custom-from-userconf'
# CHECK: {{.*}}default{{\x1b\[m}}
# CHECK: {{.*}}custom-from-userconf{{\x1b\[m}}
# CHECK: {{.*}}base16-default-dark{{\x1b\[m}}
# CHECK: {{.*}}default-dark{{\x1b\[m}}
# CHECK: {{.*}}default-light{{\x1b\[m}}
# CHECK: {{.*}}default{{\x1b\[m}}
# Override a default theme with different colors.
__fish_data_with_file themes/none.theme \