aboutsummaryrefslogtreecommitdiff
path: root/lua/pml68/plugins/guard.lua
blob: 7f609debd28a0dfd4a498d0a9ebfacc5f10f2dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
return {
  "nvimdev/guard.nvim",
  dependencies = {
    "nvimdev/guard-collection"
  },
  ft = { "c", "cpp", "h", "toml", "json", "go", "lua" },
  config = function()
    local ft = require("guard.filetype")

    ft("c,cpp,h"):fmt("clang-format")
    ft("toml"):fmt("taplo")
    ft("json"):fmt("jq")

    ft("go"):fmt({
      cmd = "golines",
      args = { "--max-len=80", "--base-formatter=gofumpt" },
      stdin = true,
    })

    vim.g.guard_config = {
      fmt_on_save = true,
      lsp_as_default_formatter = true,
    }
  end
}