Make skeleton dir/config file create a one-time initialization thing

This moves the stuff that creates skeleton/boilerplate files to
the same place we initialize uvars for the first time or on upgrade.

Being a bit less aggresssive here theoretically makes launch a little
lighter but really I personally just found it weird I couldn't
just delete my empty config.fish file without it getting recreated
and sourced every launch.
This commit is contained in:
Aaron Gyes 2022-08-14 07:05:26 -07:00
parent ce55114e38
commit 8416a52255

View file

@ -26,6 +26,16 @@ function __fish_config_interactive -d "Initializations that should be performed
# If we are starting up for the first time, set various defaults.
if test $__fish_initialized -lt 3400
# Create empty configuration directores if they do not already exist
test -e $__fish_config_dir/completions/ -a -e $__fish_config_dir/conf.d/ -a -e $__fish_config_dir/functions/ ||
mkdir -p $__fish_config_dir/{completions, conf.d, functions}
# Create config.fish with some boilerplate if it does not exist
test -e $__fish_config_dir/config.fish || echo "\
if status is-interactive
# Commands to run in interactive sessions can go here
end" >$__fish_config_dir/config.fish
# Regular syntax highlighting colors
__init_uvar fish_color_normal normal
__init_uvar fish_color_command blue
@ -271,16 +281,6 @@ function __fish_config_interactive -d "Initializations that should be performed
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
end
# Create empty configuration directores if they do not already exist
test -e $__fish_config_dir/completions/ -a -e $__fish_config_dir/conf.d/ -a -e $__fish_config_dir/functions/ ||
mkdir -p $__fish_config_dir/{completions, conf.d, functions}
# Create config.fish with some boilerplate if it does not exist
test -e $__fish_config_dir/config.fish || echo "\
if status is-interactive
# Commands to run in interactive sessions can go here
end" >$__fish_config_dir/config.fish
# Bump this whenever some code below needs to run once when upgrading to a new version.
# The universal variable __fish_initialized is initialized in share/config.fish.
set __fish_initialized 3400