Files
nvim/lua/holger/plugins/formatting.lua
T
holgerandClaude Opus 5.5 2d37451f02 added shfmt for shell scripts
Format sh/bash files with shfmt via conform and install it through
mason-tool-installer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 20:40:40 +02:00

37 lines
802 B
Lua

return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
sh = { "shfmt" },
bash = { "shfmt" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 3000,
},
})
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format file or range (in visual mode)" })
end,
}