This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/modules/neoformat.nix

33 lines
614 B
Nix
Raw Normal View History

2024-04-21 00:22:39 +03:00
{ vim, ... }:
{ configs ? {
neoformat_enabled_markdown = [ "denofmt" ];
neoformat_rust_rustfmt = {
exe = "rustfmt";
args = [ "--edition 2021" ];
stdin = 1;
};
}
}:
let inherit (builtins) concatLists attrValues mapAttrs; in
{
neoformat = concatLists [
[
(vim.g "neoformat_try_node_exe" 1)
(vim.g "neoformat_only_msg_on_error" 1)
]
(attrValues (mapAttrs vim.g configs))
[
(vim.cmd' ''
aug fmt
au!
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
aug END
'')
]
];
}