aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/formatters/shfmt.lua
blob: 6a75ff91e9cc02952f54dc6cfcbda48748756d3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---@type conform.FileFormatterConfig
return {
  meta = {
    url = "https://github.com/mvdan/sh",
    description = "A shell parser, formatter, and interpreter with `bash` support.",
  },
  command = "shfmt",
  args = function(_, ctx)
    local args = { "-filename", "$FILENAME" }
    if vim.bo[ctx.buf].expandtab then
      vim.list_extend(args, { "-i", ctx.shiftwidth })
    end
    return args
  end,
}