neovim: collect plugin configs with filter and map

generatedConfigs built its list with a non-strict foldl that appended via
acc ++ [ p.config ], an O(n^2) pattern. Filtering out null configs and
mapping is equivalent, order-preserving, and avoids the repeated list
copies.
This commit is contained in:
Austin Horstman
2026-06-17 13:04:43 -05:00
parent ce68ac6958
commit b8818d5a65
+1 -1
View File
@@ -556,7 +556,7 @@ in
generatedConfigs =
let
grouped = lib.groupBy (x: x.type) pluginsNormalized;
configsOnly = lib.foldl (acc: p: if p.config != null then acc ++ [ p.config ] else acc) [ ];
configsOnly = ps: map (p: p.config) (lib.filter (p: p.config != null) ps);
in
lib.mapAttrs (_name: vals: lib.concatStringsSep "\n" (configsOnly vals)) grouped;