1local formatter = require("formatter")
2
3formatter.setup({
4 filetype = {
5 nix = { require("formatter.filetypes.nix").alejandra },
6 lua = { require("formatter.filetypes.lua").stylua },
7 fish = { require("formatter.filetypes.fish").fishindent },
8 javascript = { require("formatter.filetypes.javascript").prettier },
9 },
10 ["*"] = {
11 require("formatter.filetypes.any").remove_trailing_whitespace,
12 },
13})
14
15vim.api.nvim_create_augroup("__formatter__", { clear = true })
16vim.api.nvim_create_autocmd("BufWritePost", {
17 group = "__formatter__",
18 command = ":FormatWrite",
19})