2021-07-07 04:55:11 +02:00
|
|
|
-- autoformat
|
|
|
|
if O.format_on_save then
|
2021-07-08 01:27:27 +02:00
|
|
|
require("lv-utils").define_augroups {
|
|
|
|
autoformat = {
|
|
|
|
{
|
|
|
|
"BufWritePre",
|
|
|
|
"*",
|
|
|
|
[[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2021-07-07 17:44:10 +02:00
|
|
|
end
|
|
|
|
|
2021-07-08 01:27:27 +02:00
|
|
|
vim.g.neoformat_run_all_formatters = 0
|
|
|
|
|
|
|
|
vim.g.neoformat_enabled_python = { "autopep8", "yapf", "docformatter" }
|
|
|
|
vim.g.neoformat_enabled_javascript = { "prettier" }
|
|
|
|
|
2021-07-07 17:44:10 +02:00
|
|
|
if not O.format_on_save then
|
2021-07-08 01:27:27 +02:00
|
|
|
vim.cmd [[if exists('#autoformat#BufWritePre')
|
2021-07-07 17:44:10 +02:00
|
|
|
:autocmd! autoformat
|
2021-07-08 01:27:27 +02:00
|
|
|
endif]]
|
2021-07-07 04:55:11 +02:00
|
|
|
end
|