From 37156d182b912a8ecb575157f6ac002d68c4483b Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 17 May 2024 15:27:04 +0300 Subject: [PATCH] modules/filetype: fixup options --- modules/filetype.nix | 21 +++++++++++---------- modules/vim/augroup.nix | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/filetype.nix b/modules/filetype.nix index bbc36af..97e4d92 100644 --- a/modules/filetype.nix +++ b/modules/filetype.nix @@ -3,13 +3,14 @@ let cfg = config.filetype; - mkFiletypeDetect = ft: pattern: { - "filetype-detect-${ft}" = { - event = [ "BufNewFile" "BufRead" ]; - inherit pattern; - command = "setfiletype ${ft}"; - }; - }; + mkFiletypeDetect = ft: pattern: + lib.nameValuePair + "filetype-detect-${ft}" + { + event = [ "BufNewFile" "BufRead" ]; + inherit pattern; + command = "setfiletype ${ft}"; + }; in { @@ -51,7 +52,7 @@ in }; ignore = mkOption { - type = extCommas; + type = uniq (listOf str); default = [ "Z" "gz" "bz2" "zip" "tgz" ]; description = '' To avoid that certain files are being inspected, the g:ft_ignore_pat variable @@ -62,7 +63,7 @@ in }; extraIgnore = mkOption { - type = extCommas; + type = uniq (listOf str); default = [ ]; }; @@ -80,7 +81,7 @@ in vim.g.ft_ignore_pat = "\\\\.(${lib.concatStringsSep "|" (cfg.ignore ++ cfg.extraIgnore)})$"; - vim.augroup = lib.mkIf (cfg.detect != { }) (lib.mapAttrsToList mkFiletypeDetect cfg.detect); + vim.augroup = lib.mkIf (cfg.detect != { }) (lib.listToAttrs (lib.mapAttrsToList mkFiletypeDetect cfg.detect)); }; } diff --git a/modules/vim/augroup.nix b/modules/vim/augroup.nix index e65267a..16b53d8 100644 --- a/modules/vim/augroup.nix +++ b/modules/vim/augroup.nix @@ -21,7 +21,7 @@ let ''; }; pattern = mkOption { - type = with types; nullOr (either str (listOf str)); + type = with types; nullOr extCommas; default = null; description = '' pattern(s) to match literally.