vimPlugins: Add vim-plug addon implementation

This commit is contained in:
Roman Volosatovs 2018-09-16 18:26:45 +02:00
parent 3f47dfff3b
commit 516a83c0e8
No known key found for this signature in database
GPG Key ID: 3AC661943D80C89E

View File

@ -172,6 +172,7 @@ let
packages ? null,
vam ? null,
pathogen ? null,
plug ? null,
customRC ? ""
}:
@ -194,6 +195,18 @@ let
execute pathogen#infect('${pluginsEnv}/{}')
'');
/* vim-plug is an extremely popular vim plugin manager.
*/
plugImpl = lib.optionalString (plug != null)
''
source ${vimPlugins.vim-plug.rtp}/plug.vim
call plug#begin('/dev/null')
'' + (lib.concatMapStringsSep "\n" (pkg: "Plug '${pkg.rtp}'") plug.plugins) + ''
call plug#end()
'';
/*
vim-addon-manager = VAM
@ -302,6 +315,7 @@ let
${vamImpl}
${pathogenImpl}
${plugImpl}
${vundleImpl}
${neobundleImpl}
${nativeImpl}
@ -427,7 +441,8 @@ rec {
packages ? {},
givenKnownPlugins ? null,
vam ? null,
pathogen ? null, ...
pathogen ? null,
plug ? null, ...
}:
let
# This is probably overcomplicated, but I don't understand this well enough to know what's necessary.
@ -439,7 +454,7 @@ rec {
vamNames = findDependenciesRecursively { inherit knownPlugins; names = lib.concatMap toNames vam.pluginDictionaries; };
names = (lib.optionals (pathogen != null) pathogenNames) ++
(lib.optionals (vam != null) vamNames);
nonNativePlugins = map (name: knownPlugins.${name}) names;
nonNativePlugins = map (name: knownPlugins.${name}) names ++ (lib.optionals (plug != null) plug.plugins);
nativePluginsConfigs = lib.attrsets.attrValues packages;
nativePlugins = lib.concatMap ({start?[], opt?[]}: start++opt) nativePluginsConfigs;
in
@ -457,6 +472,11 @@ rec {
vimrcConfig.pathogen.pluginNames = [ "vim-addon-nix" ];
};
test_vim_with_vim_addon_nix_using_plug = vim_configurable.customize {
name = "vim-with-vim-addon-nix-using-plug";
vimrcConfig.plug.plugins = with vimPlugins; [ vim-addon-nix ];
};
test_vim_with_vim_addon_nix = vim_configurable.customize {
name = "vim-with-vim-addon-nix";
vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-addon-nix ];