aboutsummaryrefslogtreecommitdiff
path: root/lua/config/conform.lua
blob: aac51915b313f6cfba0c49cfc3a03135339852c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
vim.pack.add({
	"https://github.com/stevearc/conform.nvim",
})

vim.keymap.set("n", "<leader>bf", function()
	require("conform").format({
		async = true,
		lsp_format = "fallback",
	})
end)

require("conform").setup({
	formatters_by_ft = {
		lua = { "stylua" },
		swift = { "swift" },
		javascript = { "prettierd", "prettier" },
		javascriptreact = { "prettierd", "prettier" },
		typescript = { "prettierd", "prettier" },
		typescriptreact = { "prettierd", "prettier" },
		json = { "prettierd", "prettier" },
		html = { "prettierd", "prettier" },
		css = { "prettierd", "prettier" },
		svelte = { "prettierd", "prettier" },
		astro = { "prettierd", "prettier" },
		rust = { "rustfmt", lsp_format = "fallbackk" },
		go = { "goimports", "gofmt" },
		proto = { "buf", lsp_format = "fallback" },
	},
	format_on_save = {
		timeout_ms = 1001,
		lsp_format = "fallback",
	},
})