summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/cfg/neoformat/init.lua
blob: 9a5ac768ee306848c8591364cda671b6633f5528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- autoformat
if O.format_on_save then
	require("cfg.utils").define_augroups({
		autoformat = {
			{
				"BufWritePre",
				"*",
				[[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]],
			},
		},
	})
end

vim.g.neoformat_run_all_formatters = 0

vim.g.neoformat_enabled_python = { "flake8", "black", "docformatter" }
vim.g.neoformat_enabled_javascript = { "prettier" }

if not O.format_on_save then
	vim.cmd([[if exists('#autoformat#BufWritePre')
	:autocmd! autoformat
	endif]])
end