vimUtils: fix requiredPlugins

I broke this in #52767 and didn't notice because I only tested with vim
and `requiredPlugins` is only used by neovim. This would break setups
that use string-plugins (like pathogen) with neovim.
This commit is contained in:
Timo Kaufmann 2018-12-31 10:22:15 +01:00
parent f8ff164806
commit 093cfde1e0

View File

@ -1,4 +1,4 @@
{stdenv, vim, vimPlugins, vim_configurable, buildEnv, writeText, writeScriptBin {stdenv, vim, vimPlugins, vim_configurable, neovim, buildEnv, writeText, writeScriptBin
, nix-prefetch-hg, nix-prefetch-git }: , nix-prefetch-hg, nix-prefetch-git }:
/* /*
@ -407,6 +407,7 @@ rec {
inherit (import ./build-vim-plugin.nix { inherit stdenv rtpPath vim; }) buildVimPlugin buildVimPluginFrom2Nix; inherit (import ./build-vim-plugin.nix { inherit stdenv rtpPath vim; }) buildVimPlugin buildVimPluginFrom2Nix;
# used to figure out which python dependencies etc. neovim needs
requiredPlugins = { requiredPlugins = {
packages ? {}, packages ? {},
givenKnownPlugins ? null, givenKnownPlugins ? null,
@ -420,11 +421,11 @@ rec {
if vam != null && vam ? knownPlugins then vam.knownPlugins else if vam != null && vam ? knownPlugins then vam.knownPlugins else
if pathogen != null && pathogen ? knownPlugins then pathogen.knownPlugins else if pathogen != null && pathogen ? knownPlugins then pathogen.knownPlugins else
vimPlugins; vimPlugins;
pathogenNames = findDependenciesRecursively knownPlugins pathogen.pluginNames; pathogenPlugins = findDependenciesRecursively knownPlugins pathogen.pluginNames;
vamNames = findDependenciesRecursively knownPlugins (lib.concatMap vamDictToNames vam.pluginDictionaries); vamPlugins = findDependenciesRecursively knownPlugins (lib.concatMap vamDictToNames vam.pluginDictionaries);
names = (lib.optionals (pathogen != null) pathogenNames) ++ nonNativePlugins = (lib.optionals (pathogen != null) pathogenPlugins)
(lib.optionals (vam != null) vamNames); ++ (lib.optionals (vam != null) vamPlugins)
nonNativePlugins = map (name: knownPlugins.${name}) names ++ (lib.optionals (plug != null) plug.plugins); ++ (lib.optionals (plug != null) plug.plugins);
nativePluginsConfigs = lib.attrsets.attrValues packages; nativePluginsConfigs = lib.attrsets.attrValues packages;
nativePlugins = lib.concatMap ({start?[], opt?[], knownPlugins?vimPlugins}: start++opt) nativePluginsConfigs; nativePlugins = lib.concatMap ({start?[], opt?[], knownPlugins?vimPlugins}: start++opt) nativePluginsConfigs;
in in
@ -451,4 +452,9 @@ rec {
name = "vim-with-vim-addon-nix"; name = "vim-with-vim-addon-nix";
vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ]; vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
}; };
# only neovim makes use of `requiredPlugins`, test this here
test_nvim_with_vim_nix_using_pathogen = neovim.override {
configure.pathogen.pluginNames = [ "vim-nix" ];
};
} }