neovimUtils: put optional plugins in incorrect folder

all plugins ended up in "start". Also adds a test
This commit is contained in:
Colin Heffernan 2022-09-18 21:19:11 +00:00 committed by GitHub
parent 165abe7d73
commit d309a0b9e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 2 deletions

View file

@ -222,4 +222,44 @@ rec {
export HOME=$TMPDIR
${nvimWithLuaPackages}/bin/nvim -i NONE --noplugin -es
'';
# nixpkgs should install optional packages in the opt folder
nvim_with_opt_plugin = neovim.override {
extraName = "-with-opt-plugin";
configure.packages.opt-plugins = with pkgs.vimPlugins; {
opt = [
(dashboard-nvim.overrideAttrs(old: { pname = old.pname + "-unique-for-tests-please-dont-use-opt"; }))
];
};
configure.customRC = ''
" Load all autoloaded plugins
packloadall
" Try to run Dashboard, and throw if it succeeds
try
Dashboard
echo "Dashboard found, throwing error"
cquit 1
catch /^Vim\%((\a\+)\)\=:E492/
echo "Dashboard not found"
endtry
" Load Dashboard as an optional
packadd dashboard-nvim-unique-for-tests-please-dont-use-opt
" Try to run Dashboard again, and throw if it fails
try
Dashboard
echo "Dashboard found"
catch /^Vim\%((\a\+)\)\=:E492/
echo "Dashboard not found, throwing error"
cquit 1
endtry
'';
};
run_nvim_with_opt_plugin = runTest nvim_with_opt_plugin ''
export HOME=$TMPDIR
${nvim_with_opt_plugin}/bin/nvim -i NONE +quit! -e
'';
})

View file

@ -170,8 +170,8 @@ let
throw "The neovim legacy wrapper doesn't support configure.plug anymore, please setup your plugins via 'configure.packages' instead"
else
lib.flatten (lib.mapAttrsToList genPlugin (configure.packages or {}));
genPlugin = packageName: {start ? [], opt?[]}:
start ++ opt;
genPlugin = packageName: {start ? [], opt ? []}:
start ++ (map (p: { plugin = p; optional = true; }) opt);
res = makeNeovimConfig {
inherit withPython3;