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.

39 lines
899 B

  1. return {
  2. "stevearc/conform.nvim",
  3. event = { "BufReadPre", "BufNewFile" },
  4. config = function()
  5. local conform = require("conform")
  6. conform.setup({
  7. formatters_by_ft = {
  8. lua = { "stylua" },
  9. go = { "goimports", "gofmt" },
  10. javascript = { "prettierd" },
  11. typescript = { "prettierd" },
  12. vue = { "prettierd" },
  13. css = { "prettierd" },
  14. html = { "prettierd" },
  15. markdown = { "prettierd" },
  16. json = { "fixjson" },
  17. rust = { "rustfmt" },
  18. shell = { "shfmt", "shellcheck" },
  19. python = { "isort", "black" },
  20. php = { "phpcbf" },
  21. },
  22. log_level = vim.log.levels.WARN,
  23. notify_on_error = false,
  24. })
  25. vim.keymap.set({ "n", "v" }, "<leader>F", function()
  26. conform.format({
  27. lsp_fallback = true,
  28. async = false,
  29. timeout_ms = 500,
  30. })
  31. end)
  32. conform.formatters.phpcbf = {
  33. prepend_args = { "--standard=~/.config/phpcs.xml" },
  34. }
  35. end,
  36. }