From 093cfde1e07ee534456b51c120220d0c48b46e16 Mon Sep 17 00:00:00 2001 From: Timo Kaufmann Date: Mon, 31 Dec 2018 10:22:15 +0100 Subject: [PATCH] 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. --- pkgs/misc/vim-plugins/vim-utils.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix index 1d305cd5349f..61e89521c8c9 100644 --- a/pkgs/misc/vim-plugins/vim-utils.nix +++ b/pkgs/misc/vim-plugins/vim-utils.nix @@ -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 }: /* @@ -407,6 +407,7 @@ rec { inherit (import ./build-vim-plugin.nix { inherit stdenv rtpPath vim; }) buildVimPlugin buildVimPluginFrom2Nix; + # used to figure out which python dependencies etc. neovim needs requiredPlugins = { packages ? {}, givenKnownPlugins ? null, @@ -420,11 +421,11 @@ rec { if vam != null && vam ? knownPlugins then vam.knownPlugins else if pathogen != null && pathogen ? knownPlugins then pathogen.knownPlugins else vimPlugins; - pathogenNames = findDependenciesRecursively knownPlugins pathogen.pluginNames; - vamNames = findDependenciesRecursively knownPlugins (lib.concatMap vamDictToNames vam.pluginDictionaries); - names = (lib.optionals (pathogen != null) pathogenNames) ++ - (lib.optionals (vam != null) vamNames); - nonNativePlugins = map (name: knownPlugins.${name}) names ++ (lib.optionals (plug != null) plug.plugins); + pathogenPlugins = findDependenciesRecursively knownPlugins pathogen.pluginNames; + vamPlugins = findDependenciesRecursively knownPlugins (lib.concatMap vamDictToNames vam.pluginDictionaries); + nonNativePlugins = (lib.optionals (pathogen != null) pathogenPlugins) + ++ (lib.optionals (vam != null) vamPlugins) + ++ (lib.optionals (plug != null) plug.plugins); nativePluginsConfigs = lib.attrsets.attrValues packages; nativePlugins = lib.concatMap ({start?[], opt?[], knownPlugins?vimPlugins}: start++opt) nativePluginsConfigs; in @@ -451,4 +452,9 @@ rec { name = "vim-with-vim-addon-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" ]; + }; }