✨ feat(nvim): add shfmt formatter
This commit is contained in:
parent
d96f09ff4b
commit
f66e77fbb3
1 changed files with 29 additions and 0 deletions
29
.config/nvim/lua/plugins/extras/formatting/shfmt.lua
Normal file
29
.config/nvim/lua/plugins/extras/formatting/shfmt.lua
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
local function add_formatters(tbl)
|
||||||
|
for ft, formatters in pairs(tbl) do
|
||||||
|
if opts.formatters_by_ft[ft] == nil then
|
||||||
|
opts.formatters_by_ft[ft] = formatters
|
||||||
|
else
|
||||||
|
vim.list_extend(opts.formatters_by_ft[ft], formatters)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_formatters({
|
||||||
|
["sh"] = { "shfmt" },
|
||||||
|
["bash"] = { "shfmt" },
|
||||||
|
["zsh"] = { "shfmt" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = opts.ensure_installed or {}
|
||||||
|
vim.list_extend(opts.ensure_installed, { "shfmt" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue