format.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. html = { "prettierd", "prettier" },
  13. typescript = { "prettierd", "prettier" },
  14. lua = { "stylua" },
  15. javascript = { "prettierd", "prettier", stop_after_first = true },
  16. json = { "prettierd", "prettier" },
  17. sh = { "shfmt" },
  18. bash = { "shfmt" },
  19. tex = { "latexindent" },
  20. go = { "gofumpt", "goimports-reviser", "golines" },
  21. cs = { "csharpier" },
  22. templ = { "templ" },
  23. c = { "clang-format" },
  24. cpp = { "clang-format" },
  25. },
  26. formatters = {
  27. csharpier = {
  28. command = "dotnet-csharpier",
  29. args = { "--write-stdout" },
  30. },
  31. },
  32. format_on_save = {
  33. timeout_ms = 500,
  34. lsp_fallback = true,
  35. async = false,
  36. },
  37. notify_on_error = false,
  38. })
  39. end,
  40. }