You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.1 KiB

return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettier" },
typescript = { "prettier" },
vue = { "prettier" },
css = { "prettier" },
html = { "prettier" },
markdown = { "prettier" },
json = { "fixjson" },
rust = { "rustfmt" },
shell = { "shfmt", "shellcheck" },
python = { "isort", "black" },
php = { "phpcbf" }
},
-- format_on_save = {
-- lsp_fallback = true,
-- async = false,
-- timeout_ms = 500,
-- },
-- format_after_save = {
-- lsp_fallback = true,
-- },
log_level = vim.log.levels.WARN,
notify_on_error = false,
})
vim.keymap.set({ "n", "v" }, "<leader>ff", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
})
end)
conform.formatters.phpcbf = {
prepend_args = { "--standard=~/.config/phpcs.xml" }
}
end,
}