From 8416a52255443c7b5181eef31c3b4a158f067051 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sun, 14 Aug 2022 07:05:26 -0700 Subject: [PATCH] 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. --- .../functions/__fish_config_interactive.fish | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 52d4a459f..0e14eaed4 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -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