|
|
- return {
- "stevearc/conform.nvim",
- event = { "BufReadPre", "BufNewFile" },
- config = function()
- local conform = require("conform")
-
- conform.setup({
- formatters_by_ft = {
- lua = { "stylua" },
- go = { "goimports", "gofmt" },
- javascript = { "prettierd" },
- typescript = { "prettierd" },
- vue = { "prettierd" },
- css = { "prettierd" },
- html = { "prettierd" },
- markdown = { "prettierd" },
- 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>F", function()
- conform.format({
- lsp_fallback = true,
- async = false,
- timeout_ms = 500,
- })
- end)
-
- conform.formatters.phpcbf = {
- prepend_args = { "--standard=~/.config/phpcs.xml" },
- }
- end,
- }
|