modules/neoformat: add pattern to autoformat

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-17 01:25:54 +03:00
parent b2fa93c305
commit 3bc8466912
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -23,7 +23,13 @@ let cfg = config.plugins.style.neoformat; in
}; };
}; };
autoformat.enable = mkEnableOption "Autoformat on save file"; autoformat = {
enable = mkEnableOption "Autoformat on save file";
pattern = {
type = either str commas;
default = "*";
};
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -39,7 +45,7 @@ let cfg = config.plugins.style.neoformat; in
autoformat = '' autoformat = ''
augroup autoformat augroup autoformat
autocmd! autocmd!
autocmd BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry autocmd BufWritePre ${cfg.autoformat.pattern} try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
augroup END augroup END
''; '';