Fix conform format on autosave
This commit is contained in:
parent
52c7c5099d
commit
bd1e208133
@ -1,22 +1,20 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre"},
|
||||
cmd = { "ConformInfo"},
|
||||
opts = {
|
||||
config = function()
|
||||
require("conform").setup(
|
||||
{
|
||||
formatters_by_ft = {
|
||||
php = { "pint"},
|
||||
lua = { "stylua"},
|
||||
php = { "pint" },
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
typescript = { "prettierd", "prettier", stop_after_first = true },
|
||||
java = { "clang-format", stop_after_first = true },
|
||||
java = { "clang-format", },
|
||||
cpp = { "clang-format", },
|
||||
},
|
||||
format_on_save = { timeout_ms = 500 },
|
||||
default_format_ops = {
|
||||
lsp_format = "fallback"
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
},
|
||||
},
|
||||
config = function ()
|
||||
require("conform").setup()
|
||||
})
|
||||
-- Command to run async formatting
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
@ -29,8 +27,5 @@ return {
|
||||
end
|
||||
require("conform").format({ async = true, lsp_format = "fallback", range = range })
|
||||
end, { range = true })
|
||||
|
||||
|
||||
end
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user