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.0 KiB

  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. -- format_on_save = {
  23. -- lsp_fallback = true,
  24. -- async = false,
  25. -- timeout_ms = 500,
  26. -- },
  27. -- format_after_save = {
  28. -- lsp_fallback = true,
  29. -- },
  30. log_level = vim.log.levels.WARN,
  31. notify_on_error = false,
  32. })
  33. vim.keymap.set({ "n", "v" }, "<leader>F", function()
  34. conform.format({
  35. lsp_fallback = true,
  36. async = false,
  37. timeout_ms = 500,
  38. })
  39. end)
  40. conform.formatters.phpcbf = {
  41. prepend_args = { "--standard=~/.config/phpcs.xml" },
  42. }
  43. end,
  44. }