Enable formatting on save

I've usually been against auto-formatting on save and instead preferred
to trigger it manually using its own keybinding.

I'm enabling it for now to see how I feel about it and I'll either keep
or revert it.
This commit is contained in:
Oliver Davies 2024-06-10 09:59:29 +01:00
parent e8531ba993
commit b00cef78af

View file

@ -13,6 +13,12 @@ conform.setup {
},
}
vim.keymap.set("n", "<leader>f", function()
conform.format { lsp_fallback = true, async = false, timeout_ms = 500 }
end)
vim.api.nvim_create_autocmd("BufWritePre", {
callback = function(args)
conform.format {
bufnr = args.buf,
lsp_fallback = true,
quiet = true,
}
end,
})