format.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. },
  27. formatters = {
  28. csharpier = {
  29. command = "dotnet-csharpier",
  30. args = { "--write-stdout" },
  31. },
  32. },
  33. format_on_save = {
  34. timeout_ms = 500,
  35. lsp_fallback = true,
  36. async = false,
  37. },
  38. notify_on_error = false,
  39. })
  40. end,
  41. }