43 lines
976 B
Lua
43 lines
976 B
Lua
return {
|
|
"stevearc/conform.nvim",
|
|
event = { "BufWritePre" },
|
|
keys = {
|
|
{
|
|
"<leader>cf",
|
|
function()
|
|
require("conform").format({ async = true, lsp_fallback = true })
|
|
end,
|
|
desc = "Format buffer"
|
|
},
|
|
{
|
|
"<leader>cF",
|
|
function()
|
|
require("conform").format({ formatters = { "injected" } })
|
|
end,
|
|
desc = "Format injected langs"
|
|
},
|
|
},
|
|
opts = {
|
|
formatters_by_ft = {
|
|
javascript = { "prettier" },
|
|
typescript = { "prettier" },
|
|
javascriptreact = { "prettier" },
|
|
typescriptreact = { "prettier" },
|
|
css = { "prettier" },
|
|
html = { "prettier" },
|
|
json = { "prettier" },
|
|
yaml = { "prettier" },
|
|
markdown = { "prettier" },
|
|
lua = { "stylelua" },
|
|
python = { "black" },
|
|
php = { "php_cs_fixer" },
|
|
go = { "gofmt" },
|
|
rurst = { "rustfmt" },
|
|
},
|
|
format_on_save = {
|
|
timeout_ms = 500,
|
|
lsp_fallback = true
|
|
}
|
|
}
|
|
}
|