modules/filetype: fixup options
This commit is contained in:
parent
e5f2d7236a
commit
37156d182b
2 changed files with 12 additions and 11 deletions
|
@ -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));
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue