format.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. return {
  2. "stevearc/conform.nvim",
  3. event = {
  4. "BufReadPre",
  5. "BufNewFile",
  6. },
  7. config = function()
  8. require("conform").setup({
  9. formatters_by_ft = {
  10. graphql = { "prettierd", "prettier" },
  11. njk = { "prettierd", "prettier" },
  12. svelte = { lsp_format = "fallback" },
  13. html = { "prettierd", "prettier" },
  14. typescript = { "prettierd", "prettier" },
  15. lua = { "stylua" },
  16. javascript = { "prettierd", "prettier", stop_after_first = true },
  17. json = { "prettierd", "prettier" },
  18. sh = { "shfmt" },
  19. bash = { "shfmt" },
  20. tex = { "latexindent" },
  21. go = { "gofumpt", "goimports-reviser", "golines" },
  22. cs = { "csharpier" },
  23. templ = { "templ" },
  24. c = { "clang-format" },
  25. cpp = { "clang-format" },
  26. hcl = { "hcl" },
  27. },
  28. formatters = {
  29. csharpier = {
  30. command = "dotnet-csharpier",
  31. args = { "--write-stdout" },
  32. },
  33. },
  34. format_on_save = {
  35. timeout_ms = 500,
  36. lsp_fallback = true,
  37. async = false,
  38. },
  39. notify_on_error = false,
  40. })
  41. end,
  42. }