mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
neovim/coc: fix loading CoC plugin
Specifically, refactored all places that use cfg.plugins to use a new combined list that includes CoC if it's enabled.
This commit is contained in:
parent
e01facc340
commit
6edcc270c5
1 changed files with 19 additions and 7 deletions
|
@ -64,14 +64,21 @@ let
|
||||||
'' else
|
'' else
|
||||||
"";
|
"";
|
||||||
|
|
||||||
|
allPlugins = cfg.plugins ++ optional cfg.coc.enable {
|
||||||
|
type = "viml";
|
||||||
|
plugin = pkgs.vimPlugins.coc-nvim;
|
||||||
|
config = cfg.coc.pluginConfig;
|
||||||
|
optional = false;
|
||||||
|
};
|
||||||
|
|
||||||
moduleConfigure = {
|
moduleConfigure = {
|
||||||
packages.home-manager = {
|
packages.home-manager = {
|
||||||
start = remove null (map
|
start = remove null (map
|
||||||
(x: if x ? plugin && x.optional == true then null else (x.plugin or x))
|
(x: if x ? plugin && x.optional == true then null else (x.plugin or x))
|
||||||
cfg.plugins);
|
allPlugins);
|
||||||
opt = remove null
|
opt = remove null
|
||||||
(map (x: if x ? plugin && x.optional == true then x.plugin else null)
|
(map (x: if x ? plugin && x.optional == true then x.plugin else null)
|
||||||
cfg.plugins);
|
allPlugins);
|
||||||
};
|
};
|
||||||
beforePlugins = "";
|
beforePlugins = "";
|
||||||
};
|
};
|
||||||
|
@ -328,6 +335,12 @@ in {
|
||||||
for options.
|
for options.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pluginConfig = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
description = "Script to configure CoC. Must be viml.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -342,16 +355,15 @@ in {
|
||||||
plugin = x;
|
plugin = x;
|
||||||
config = "";
|
config = "";
|
||||||
optional = false;
|
optional = false;
|
||||||
}) cfg.plugins;
|
}) allPlugins;
|
||||||
suppressNotVimlConfig = p:
|
suppressNotVimlConfig = p:
|
||||||
if p.type != "viml" then p // { config = ""; } else p;
|
if p.type != "viml" then p // { config = ""; } else p;
|
||||||
|
|
||||||
neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
|
neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
|
||||||
inherit (cfg)
|
inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias;
|
||||||
extraPython3Packages withPython3 withNodeJs withRuby viAlias vimAlias;
|
withNodeJs = cfg.withNodeJs or cfg.coc.enable;
|
||||||
configure = cfg.configure // moduleConfigure;
|
configure = cfg.configure // moduleConfigure;
|
||||||
plugins = (map suppressNotVimlConfig pluginsNormalized)
|
plugins = map suppressNotVimlConfig pluginsNormalized;
|
||||||
++ optionals cfg.coc.enable [{ plugin = pkgs.vimPlugins.coc-nvim; }];
|
|
||||||
customRC = cfg.extraConfig;
|
customRC = cfg.extraConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue