gabrielgio.lua @ 73f8ec6c9ab2929bb392f0db5922045a9ad62107

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