From 3340a4f427b6d7e7edd8e5ddeb9ce589467c0a93 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Mon, 6 Jul 2026 11:05:54 +0200 Subject: conform.nvim: Formatter vereinheitlicht --- nvim/lua/plugins/format.lua | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'nvim/lua/plugins/format.lua') diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua index f80ee2d..561db8b 100644 --- a/nvim/lua/plugins/format.lua +++ b/nvim/lua/plugins/format.lua @@ -1,3 +1,15 @@ +-- Verfügbare Formater: https://github.com/stevearc/conform.nvim/tree/master/lua/conform/formatters + +local clang = {} +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 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" }, @@ -12,20 +24,20 @@ return { }, opts = { formatters_by_ft = { - awk = { "gawk" }, -- brew install gawk, pkg install gawk - bash = { "shfmt" }, -- brew install shfmt, pkg install shfmt - c = {}, -- clangd - cpp = {}, -- clangd - html = { "prettier" }, -- (siehe "typescript") - javascript = { "prettier" }, -- (siehe "typescript") - json = { "jq" }, -- brew install jq, pkg install jq - lua = { "stylua" }, -- brew install stylua, pkg install stylua - python = { "ruff_format" }, -- brew install ruff, pkg install ruff - sh = { "shfmt" }, -- brew install, pkg install shfmt - typescript = { "prettier" }, -- npm install -g prettier - xml = { "xmllint" }, -- xmllint ist Teil von libxml2 (standardmäßig installiert unter MacOS; pkg install libxml2) - xsd = { "xmllint" }, - yaml = { "yamlfmt" }, -- brew install yamlfmt, pkg install yamlfmt + awk = gawk, + bash = shfmt, + c = clang, + cpp = clang, + html = prettier, + javascript = prettier, + json = jq, + lua = stylua, + python = ruff, + sh = shfmt, + typescript = prettier, + xml = xmllint, + xsd = xmllint, + yaml = yamlfmt, }, default_format_opts = { lsp_format = "fallback", -- cgit v1.3