From d10379f2edf3626191a43227dd5fd90a62d9b978 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Fri, 5 Jun 2026 09:54:03 +0200 Subject: Neovim: Formatiere alles mit "stylua `find . -name '*.lua'`" --- nvim/lua/config/statusline.lua | 71 ++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 47 deletions(-) (limited to 'nvim/lua/config/statusline.lua') diff --git a/nvim/lua/config/statusline.lua b/nvim/lua/config/statusline.lua index 63c8ba8..fe27cd5 100644 --- a/nvim/lua/config/statusline.lua +++ b/nvim/lua/config/statusline.lua @@ -1,13 +1,13 @@ local M = {} local modes = { - n = { "NORMAL", "StatuslineModeNormal" }, - i = { "INSERT", "StatuslineModeInsert" }, - v = { "VISUAL", "StatuslineModeVisual" }, - V = { "V-LINE", "StatuslineModeVisual" }, + n = { "NORMAL", "StatuslineModeNormal" }, + i = { "INSERT", "StatuslineModeInsert" }, + v = { "VISUAL", "StatuslineModeVisual" }, + V = { "V-LINE", "StatuslineModeVisual" }, [""] = { "V-BLOCK", "StatuslineModeVisual" }, - R = { "REPLACE", "StatuslineModeReplace" }, - c = { "COMMAND", "StatuslineModeCommand" }, + R = { "REPLACE", "StatuslineModeReplace" }, + c = { "COMMAND", "StatuslineModeCommand" }, } local function mode() @@ -35,9 +35,7 @@ local function update_git_branch(bufnr) return end - local branch = vim.fn.systemlist( - "git rev-parse --abbrev-ref HEAD 2>/dev/null" - )[1] + local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>/dev/null")[1] if branch and branch ~= "" then vim.b[bufnr].git_branch = "  " .. branch .. " " @@ -50,14 +48,11 @@ end -- Autocmd: Git nur bei Bedarf aktualisieren ---------------------------------------------------------------------- -vim.api.nvim_create_autocmd( - { "BufEnter", "FocusGained" }, - { - callback = function(args) - update_git_branch(args.buf) - end, - } -) +vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained" }, { + callback = function(args) + update_git_branch(args.buf) + end, +}) ---------------------------------------------------------------------- -- Statusline-Sektionen (reine Darstellung, keine IO) @@ -80,9 +75,7 @@ local function git_diff() if gsd.changed and gsd.changed > 0 then table.insert(parts, "~" .. gsd.changed) end if gsd.removed and gsd.removed > 0 then table.insert(parts, "-" .. gsd.removed) end - if #parts > 0 then - return " " .. table.concat(parts, " ") .. " " - end + if #parts > 0 then return " " .. table.concat(parts, " ") .. " " end return "" end @@ -93,13 +86,9 @@ end local function filename() local name = vim.fn.expand("%:.") - if name == "" then - name = "[No Name]" - end + if name == "" then name = "[No Name]" end - if vim.bo.modified then - name = name .. " [+]" - end + if vim.bo.modified then name = name .. " [+]" end return " " .. name .. " " end @@ -110,9 +99,7 @@ end local function treesitter() local ok = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] - if ok then - return " 🌳 " - end + if ok then return " 🌳 " end return "" end @@ -123,9 +110,9 @@ end local function diagnostics() local counts = { error = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }), - warn = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }), - info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }), - hint = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }), + warn = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }), + info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }), + hint = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }), } local parts = {} @@ -135,9 +122,7 @@ local function diagnostics() if counts.info > 0 then table.insert(parts, "  " .. counts.info) end if counts.hint > 0 then table.insert(parts, "  " .. counts.hint) end - if #parts > 0 then - return " " .. table.concat(parts, " ") .. " " - end + if #parts > 0 then return " " .. table.concat(parts, " ") .. " " end return "" end @@ -165,21 +150,13 @@ end ------------------------------------------------------------------------- local function copilot() - if vim.fn.exists("*copilot#Enabled") == 0 then - return "" - end + if vim.fn.exists("*copilot#Enabled") == 0 then return "" end - if vim.fn["copilot#Enabled"]() == 0 then - return "  OFF " - end + if vim.fn["copilot#Enabled"]() == 0 then return "  OFF " end - if vim.b.copilot_suggestion and vim.b.copilot_suggestion.is_visible then - return "  SUG " - end + if vim.b.copilot_suggestion and vim.b.copilot_suggestion.is_visible then return "  SUG " end - if vim.b.copilot_suggestion_auto_trigger == false then - return "  MAN " - end + if vim.b.copilot_suggestion_auto_trigger == false then return "  MAN " end return "  ON " end -- cgit v1.3