-- Verfügbare Formater: https://github.com/stevearc/conform.nvim/tree/master/lua/conform/formatters local clang = {} local djlint = { "djlint" } -- pipx install djlint (macOS & FreeBSD); unter Windows kein winget-Paket, siehe neovim-windows-setup.md local gawk = { "gawk" } -- brew install gawk, pkg install gawk local jq = { "jq" } -- brew install jq, pkg install jq local prettier = { "prettier" } -- npm install -g prettier local prettier_jsonc = { "prettier_jsonc" } -- prettier-Variante, konfiguriert unter opts.formatters local ruff = { "ruff_format" } -- brew install ruff, pkg install ruff local shfmt = { "shfmt" } -- brew install shfmt, pkg install shfmt local stylua = { "stylua" } -- brew install stylua, pkg install stylua local xmllint = { "xmllint" } -- xmllint ist Teil von libxml2 (standardmäßig installiert unter MacOS; pkg install libxml2) local yamlfmt = { "yamlfmt" } -- brew install yamlfmt, pkg install yamlfmt return { "stevearc/conform.nvim", event = { "BufReadPre", "BufNewFile" }, keys = { { "cf", function() require("conform").format({ async = true }) end, desc = "Format file", }, }, opts = { formatters_by_ft = { awk = gawk, bash = shfmt, c = clang, cpp = clang, html = prettier, javascript = prettier, jinja = djlint, json = jq, jsonc = prettier_jsonc, lua = stylua, python = ruff, sh = shfmt, typescript = prettier, xml = xmllint, xsd = xmllint, yaml = yamlfmt, }, formatters = { prettier_jsonc = { inherit = "prettier", prepend_args = { "--parser", "jsonc" }, }, }, default_format_opts = { lsp_format = "fallback", }, }, }