1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29: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
# the original source to be undisturbed.
# Each plugin gets a corresponding conf.d/plugin-NAME.fish file to load
# in the paths and any initialization scripts.
(mkIf (length cfg.plugins > 0) {
xdg.configFile."fish/conf.d/99plugins.fish".text = concatStrings
(map (plugin: ''
xdg.configFile = mkMerge (
(map (plugin: { "fish/conf.d/plugin-${plugin.name}.fish".text = ''
# Plugin ${plugin.name}
if test -d ${plugin.src}/functions
set fish_function_path $fish_function_path[1] ${plugin.src}/functions $fish_function_path[2..-1]
set -l plugin_dir ${plugin.src}
# 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
if test -d ${plugin.src}/completions
set fish_complete_path $fish_function_path[1] ${plugin.src}/completions $fish_complete_path[2..-1]
if test -d $plugin_dir"/completions"
set fish_complete_path $fish_function_path[1] $plugin_dir"/completions" $fish_complete_path[2..-1]
end
if test -d ${plugin.src}/conf.d
source ${plugin.src}/conf.d/*.fish
# Source initialization code if it exists.
if test -d $plugin_dir"/conf.d"
source $plugin_dir"/conf.d/*.fish"
end
if test -f ${plugin.src}/key_bindings.fish
source ${plugin.src}/key_bindings.fish
if test -f $plugin_dir"/key_bindings.fish"
source $plugin_dir"/key_bindings.fish"
end
if test -f ${plugin.src}/init.fish
source ${plugin.src}/init.fish
if test -f $plugin_dir"/init.fish"
source $plugin_dir"/init.fish"
end
''
) cfg.plugins);
'';
}) cfg.plugins));
})
]);
}