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

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