Skip to content

Commit

Permalink
fix(bash): make shfmt respect indentation settings with conform
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jun 26, 2024
1 parent 9b791f1 commit e0596e0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/astrocommunity/pack/bash/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ return {
formatters_by_ft = {
sh = { "shfmt" },
},
formatters = {
shfmt = {
prepend_args = function(_, ctx)
local args = {}
local bo = vim.bo[ctx.buf]
if bo.expandtab then
local tab_size = bo.tabstop or 2
local indent_size = bo.shiftwidth
if indent_size == 0 or not indent_size then indent_size = tab_size end
vim.list_extend(args, { "-i", tostring(indent_size) })
end
return args
end,
},
},
},
},
{
Expand Down

0 comments on commit e0596e0

Please sign in to comment.