From 742016f4559884db504033785ee92f64ba1152ad Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 26 Apr 2025 09:11:47 +0200 Subject: [PATCH] __fish_config_interactive: reuse default theme (As suggested in 84e7fbd4662 (Make default .theme file consistent with uvars, 2022-02-03)) Historical behavior in default fish is that 1. fish_color_keyword and fish_color_option are unset, meaning they default to their fallbacks, fish_color_command and fish_color_param. 2. colors not mentioned in the default them, such as fish_pager_color_secondary_background, are unset "fish_config theme save fish\ default" - sets group 1 to a non-empty value (deactivating the fallbacks) - sets group 2 to an empty value (which has no function change except it changes completions for builtin set) Both are probably fine. I guess the historical behavior is a bit nicer. But the new behavior is simpler. We can definitely optimize it later, for example by never redundantly setting universal color variables to an empty value. --- .../functions/__fish_config_interactive.fish | 51 ++----------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index cc97fe927..921ef097f 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -30,54 +30,11 @@ if status is-interactive # Commands to run in interactive sessions can go here end" >$__fish_config_dir/config.fish - # Regular syntax highlighting colors - # NOTE: These should only use named colors - # to give us the maximum chance they are - # visible in whatever terminal setup. - # - __init_uvar fish_color_normal normal - __init_uvar fish_color_command normal - __init_uvar fish_color_param cyan - __init_uvar fish_color_redirection cyan --bold - __init_uvar fish_color_comment red - __init_uvar fish_color_error brred - __init_uvar fish_color_escape brcyan - __init_uvar fish_color_operator brcyan - __init_uvar fish_color_end green - __init_uvar fish_color_quote yellow - __init_uvar fish_color_autosuggestion brblack - __init_uvar fish_color_user brgreen - __init_uvar fish_color_host normal - __init_uvar fish_color_host_remote yellow - __init_uvar fish_color_valid_path --underline - __init_uvar fish_color_status red - - __init_uvar fish_color_cwd green - __init_uvar fish_color_cwd_root red - - # Background color for selections - __init_uvar fish_color_selection white --bold --background=brblack - - __init_uvar fish_color_cancel -r - - # Pager colors - __init_uvar fish_pager_color_prefix normal --bold --underline - __init_uvar fish_pager_color_completion normal - __init_uvar fish_pager_color_description yellow -i - __init_uvar fish_pager_color_progress brwhite --background=cyan - __init_uvar fish_pager_color_selected_background -r - - # - # Directory history colors - # - __init_uvar fish_color_history_current --bold + echo yes | fish_config theme save "fish default" + set -Ue fish_color_keyword fish_color_option end - if test $__fish_initialized -lt 3800 - # Background color for search matches - __init_uvar fish_color_search_match white --background=brblack - if test "$fish_color_search_match[1]" = bryellow - set --universal fish_color_search_match[1] white - end + if test $__fish_initialized -lt 3800 && test "$fish_color_search_match[1]" = bryellow + set --universal fish_color_search_match[1] white end #