format.lua 1016 B

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