From c8337b654e912faaee641f6bc1d8547779597e39 Mon Sep 17 00:00:00 2001 From: Benedict Lee Date: Tue, 23 Jul 2019 13:20:52 +0800 Subject: [PATCH] Enable conf.d loading for themes (#713) Loading of conf.d files for the current theme is done after all other initialisation to ensure that everything the files need is loaded. --- init.fish | 5 +++++ pkg/omf/functions/themes/omf.theme.set.fish | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/init.fish b/init.fish index 2ac23aa..235d7ea 100644 --- a/init.fish +++ b/init.fish @@ -48,4 +48,9 @@ end emit perf:timer:start "Oh My Fish init user config path" require --no-bundle --path $OMF_CONFIG emit perf:timer:finish "Oh My Fish init user config path" +# Load conf.d for current theme if exists +set -l theme_conf_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme/conf.d +for conf in $theme_conf_path/*.fish + source $conf +end emit perf:timer:finish "Oh My Fish initialisation" diff --git a/pkg/omf/functions/themes/omf.theme.set.fish b/pkg/omf/functions/themes/omf.theme.set.fish index 0edd03f..b28619f 100644 --- a/pkg/omf/functions/themes/omf.theme.set.fish +++ b/pkg/omf/functions/themes/omf.theme.set.fish @@ -37,6 +37,11 @@ function omf.theme.set -a target_theme and test -e $OMF_CONFIG/key_bindings.fish -o -e $OMF_PATH/key_bindings.fish and __fish_reload_key_bindings + # Load target theme's conf.d files + for conf in {$OMF_CONFIG,$OMF_PATH}/themes/$target_theme/conf.d/*.fish + source $conf + end + # Persist the changes echo "$target_theme" > "$OMF_CONFIG/theme"