nix-community.nixvim/modules/plugins.nix
Matt Sturgeon faff32b9f1
plugins/by-name: init
Add support for automatically importing any directories under
`plugins/by-name`.

Includes a validation test, which is run by CI and by the pre-commit hook.
2024-09-09 11:50:38 +01:00

17 lines
400 B
Nix

{ lib, ... }:
let
inherit (builtins) readDir pathExists;
inherit (lib.attrsets) foldlAttrs;
inherit (lib.lists) optional optionals;
by-name = ../plugins/by-name;
in
{
imports =
[ ../plugins ]
++ optionals (pathExists by-name) (
foldlAttrs (
prev: name: type:
prev ++ optional (type == "directory") (by-name + "/${name}")
) [ ] (readDir by-name)
);
}