1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 15:09:46 +01:00

fish: plugins separated into conf.d files

This was done to make it easier for the generated files to be understood.
This commit is contained in:
Ryan Orendorff 2019-09-24 23:20:53 -07:00 committed by Robert Helgesson
parent 639f6fea8c
commit 108259925a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -291,34 +291,37 @@ in
} }
# Plugins are all sources together in a conf.d file as this allows # Each plugin gets a corresponding conf.d/plugin-NAME.fish file to load
# the original source to be undisturbed. # in the paths and any initialization scripts.
(mkIf (length cfg.plugins > 0) { (mkIf (length cfg.plugins > 0) {
xdg.configFile."fish/conf.d/99plugins.fish".text = concatStrings xdg.configFile = mkMerge (
(map (plugin: '' (map (plugin: { "fish/conf.d/plugin-${plugin.name}.fish".text = ''
# Plugin ${plugin.name} # Plugin ${plugin.name}
if test -d ${plugin.src}/functions set -l plugin_dir ${plugin.src}
set fish_function_path $fish_function_path[1] ${plugin.src}/functions $fish_function_path[2..-1]
# Set paths to import plugin components
if test -d $plugin_dir"/functions"
set fish_function_path $fish_function_path[1] $plugin_dir"/functions" $fish_function_path[2..-1]
end end
if test -d ${plugin.src}/completions if test -d $plugin_dir"/completions"
set fish_complete_path $fish_function_path[1] ${plugin.src}/completions $fish_complete_path[2..-1] set fish_complete_path $fish_function_path[1] $plugin_dir"/completions" $fish_complete_path[2..-1]
end end
if test -d ${plugin.src}/conf.d # Source initialization code if it exists.
source ${plugin.src}/conf.d/*.fish if test -d $plugin_dir"/conf.d"
source $plugin_dir"/conf.d/*.fish"
end end
if test -f ${plugin.src}/key_bindings.fish if test -f $plugin_dir"/key_bindings.fish"
source ${plugin.src}/key_bindings.fish source $plugin_dir"/key_bindings.fish"
end end
if test -f ${plugin.src}/init.fish if test -f $plugin_dir"/init.fish"
source ${plugin.src}/init.fish source $plugin_dir"/init.fish"
end end
'';
'' }) cfg.plugins));
) cfg.plugins);
}) })
]); ]);
} }