fix: conform format on save

Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
Lander Van den Bulcke 2025-10-19 19:51:13 +02:00
parent 90cfc16bc0
commit 6d87646eaf
Signed by: lander
GPG key ID: 0142722B4B0C536F

View file

@ -8,39 +8,13 @@
default_format_opts.lsp_format = "prefer";
notify_on_error = true;
format_on_save = ''
function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
format_on_save = {
lsp_format = "prefer";
};
if slow_format_filetypes[vim.bo[bufnr].filetype] then
return
end
local function on_format(err)
if err and err:match("timeout$") then
slow_format_filetypes[vim.bo[bufnr].filetype] = true
end
end
return { timeout_ms = 200, lsp_fallback = true }, on_format
end
'';
format_after_save = ''
function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
return
end
return { lsp_fallback = true }
end
'';
format_after_save = {
lsp_format = "prefer";
};
formatters_by_ft = {
"_" = [