diff options
Diffstat (limited to 'lua/conform/formatters/shfmt.lua')
-rw-r--r-- | lua/conform/formatters/shfmt.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/conform/formatters/shfmt.lua b/lua/conform/formatters/shfmt.lua index 29b8615..6a75ff9 100644 --- a/lua/conform/formatters/shfmt.lua +++ b/lua/conform/formatters/shfmt.lua @@ -5,5 +5,11 @@ return { description = "A shell parser, formatter, and interpreter with `bash` support.", }, command = "shfmt", - args = { "-filename", "$FILENAME" }, + 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, } |