modules/neoformat: add pattern to autoformat
This commit is contained in:
parent
b2fa93c305
commit
3bc8466912
1 changed files with 8 additions and 2 deletions
|
@ -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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue