fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
6d0cd3d9b
master
1# localization: skip(private) 2function __fish_theme_migrate 3functions -e __fish_theme_migrate 4 5set -l migration_version4300 6 7# Maybe migrate. 8if not set -q __fish_initialized|| test $__fish_initialized -ge $migration_version 9return 10end 11 12set -l removing_uvars false 13set -l msg 14# Copy legacy uvars to globals. 15set -l theme_uvars( __fish_theme_variables --universal) 16if set -q theme_uvars[ 1 ] 17set removing_uvars true 18set -l msg_suffix . 19if not __fish_config_theme_uvars_subset_of_historical_default $theme_uvars 20for varnamein $theme_uvars 21set -g$varname $$varname 22end 23set -l theme_data 24for varnamein $theme_uvars 25set -a theme_data"$ ( string escape -- $varname $$varname | string join " " ) " 26end 27__fish_theme_freeze __fish_theme_migrate$theme_data 28set msg_suffix" by default."\n" Migrated them to global variables set in $ ( set_color --underline ) $ ( 29__fish_unexpand_tilde $__fish_config_dir /conf.d/fish_frozen_theme.fish 30) $ ( set_color --reset ) " 31end 32set -a msg"* Color variables are no longer set in universal scope $msg_suffix " 33set -a msg' To restore syntax highlighting in other fish sessions, please restart them.' 34end 35if set -Uq fish_key_bindings 36set removing_uvars true 37set -l relative_filename conf.d/fish_frozen_key_bindings.fish 38set -l filename$__fish_config_dir /$relative_filename 39__fish_backup_config_files $relative_filename 40mkdir -p --( path dirname --$filename ) 41echo > $filename "\ 42# This file was created by fish when upgrading to version >= 4.3, to migrate 43# the 'fish_key_bindings' variable from its old default scope (universal) 44# to its new default scope (global). We recommend you delete this file 45# and configure key bindings in ~/.config/fish/config.fish if needed. 46 47$ ( 48# No need to freeze the default value. 49test " $fish_key_bindings " = fish_default_key_bindings 50# Nor if the user has shadowed our previous uvar. 51or set -qg fish_key_bindings 52and echo "# " 53) set --global fish_key_bindings $fish_key_bindings 54 55# Prior to version 4.3, fish shipped an event handler that runs 56# `set --universal fish_key_bindings fish_default_key_bindings` 57# whenever the fish_key_bindings variable is erased. 58# This means that as long as any fish < 4.3 is still running on this system, 59# we cannot complete the migration. 60# As a workaround, erase the universal variable at every shell startup. 61set --erase --universal fish_key_bindings" 62set -a msg'* The fish_key_bindings variable is no longer set in universal scope by default.' 63set -a msg( echo -s" Migrated it to a global variable set in " \ 64"$ ( set_color --underline ) $ ( __fish_unexpand_tilde $filename ) " \ 65( set_color --reset)) 66source $__fish_config_dir /$relative_filename 67end 68# TODO In a few years, stop setting it. 69set -U __fish_initialized$migration_version 70if $removing_uvars 71echo -s( set_color --bold) 'fish:' ( set_color --reset) " upgraded to version >= 4.3.0:" 72string join\n --$msg 73echo 'See also the release notes for 4.3.0 (type `help relnotes`).' 74set -Ue fish_key_bindings$theme_uvars 75set -l sh( __fish_posix_shell ) 76eval " $sh -c 'sleep 7 # Please read above notice about universal variables' </dev/null &>/dev/null &" 77end 78end 79 80function __fish_config_theme_matches --no-scope-shadowing 81set -l varname$argv [ 1 ] 82set -l possible_values$argv [ 2 .. ] 83if not set -q possible_values[ 1 ] 84set possible_values normal"" --reset 85end 86set -a checked_varnames$varname 87not set -q$varname 88or contains --" $$varname " $possible_values 89end 90function __fish_config_theme_uvars_subset_of_historical_default 91set -l checked_varnames 92set -l matches __fish_config_theme_matches 93$matches fish_color_keyword" $fish_color_command " 94and $matches fish_color_option" $fish_color_param " 95and $matches fish_color_autosuggestion brblack"555 brblack" 96and $matches fish_color_cancel -r 97and $matches fish_color_command normal blue --reset 98and $matches fish_color_comment red 99and $matches fish_color_cwd green 100and $matches fish_color_cwd_root red 101and $matches fish_color_end green 102and $matches fish_color_error brred 103and $matches fish_color_escape brcyan 104and $matches fish_color_history_current --bold 105and $matches fish_color_host 106and $matches fish_color_host_remote yellow 107and $matches fish_color_normal 108and $matches fish_color_operator brcyan 109and $matches fish_color_param cyan 110and $matches fish_color_quote yellow 111and $matches fish_color_redirection"cyan --bold" 112and $matches fish_color_search_match\ 113"--background=111" \ 114"--background=brblack" \ 115"bryellow --background=brblack" \ 116"bryellow --background=brblack --bold" \ 117"white --background=brblack" \ 118"white --background=brblack --bold" 119and $matches fish_color_selection\ 120"white --background=brblack --bold" \ 121"white --bold --background=brblack" 122and $matches fish_color_status red 123and $matches fish_color_user brgreen 124and $matches fish_color_valid_path --underline 125and $matches fish_color_background 126and $matches fish_pager_color_background 127and $matches fish_pager_color_completion 128and $matches fish_pager_color_description"B3A06D yellow -i" "yellow -i" "yellow --italics" 129and $matches fish_pager_color_prefix\ 130"normal --bold --underline" \ 131"cyan --bold --underline" \ 132"--bold --underline" 133and $matches fish_pager_color_progress\ 134"brwhite --background=cyan" \ 135"brwhite --background=cyan --bold" 136and $matches fish_pager_color_secondary_background 137and $matches fish_pager_color_secondary_completion 138and $matches fish_pager_color_secondary_description 139and $matches fish_pager_color_secondary_prefix 140and $matches fish_pager_color_selected_background -r 141and $matches fish_pager_color_selected_completion 142and $matches fish_pager_color_selected_description 143and $matches fish_pager_color_selected_prefix 144and $matches fish_color_match --background=brblue 145and for uvarin $argv 146contains $uvar $checked_varnames 147or test -z " $$uvar " 148or return 149end 150end