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