diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-06-05 09:54:03 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-06-05 09:54:03 +0200 |
| commit | d10379f2edf3626191a43227dd5fd90a62d9b978 (patch) | |
| tree | f04345d25e9e08c08204692c235202ece16e9470 /nvim | |
| parent | 011f3e8f670db9fa5e4edfb10db302ac9833eeb9 (diff) | |
| download | dotfiles-d10379f2edf3626191a43227dd5fd90a62d9b978.tar.gz dotfiles-d10379f2edf3626191a43227dd5fd90a62d9b978.tar.bz2 dotfiles-d10379f2edf3626191a43227dd5fd90a62d9b978.zip | |
Neovim: Formatiere alles mit "stylua `find . -name '*.lua'`"
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/lua/config/keymaps.lua | 20 | ||||
| -rw-r--r-- | nvim/lua/config/lazy.lua | 2 | ||||
| -rw-r--r-- | nvim/lua/config/options.lua | 2 | ||||
| -rw-r--r-- | nvim/lua/config/statusline.lua | 71 | ||||
| -rw-r--r-- | nvim/lua/plugins/editing.lua | 2 | ||||
| -rw-r--r-- | nvim/lua/plugins/format.lua | 24 |
6 files changed, 54 insertions, 67 deletions
diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 558742d..b776697 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua | |||
| @@ -28,17 +28,27 @@ function M.lsp(buffer, client) | |||
| 28 | vim.cmd("cwindow") | 28 | vim.cmd("cwindow") |
| 29 | end, opts) | 29 | end, opts) |
| 30 | 30 | ||
| 31 | map("n", "<F6>", function() run_in_terminal("gmake test") end, opts) | 31 | map("n", "<F6>", function() |
| 32 | run_in_terminal("gmake test") | ||
| 33 | end, opts) | ||
| 32 | end | 34 | end |
| 33 | 35 | ||
| 34 | local function set_python_bindings() | 36 | local function set_python_bindings() |
| 35 | map("n", "<F6>", function() run_in_terminal("pytest") end, opts) | 37 | map("n", "<F6>", function() |
| 38 | run_in_terminal("pytest") | ||
| 39 | end, opts) | ||
| 36 | end | 40 | end |
| 37 | 41 | ||
| 38 | local function set_npm_bindings() | 42 | local function set_npm_bindings() |
| 39 | map("n", "<F5>", function() run_in_terminal("npm run build") end, opts) | 43 | map("n", "<F5>", function() |
| 40 | map("n", "<F6>", function() run_in_terminal("npm test") end, opts) | 44 | run_in_terminal("npm run build") |
| 41 | map("n", "<F7>", function() run_in_terminal("npm start") end, opts) | 45 | end, opts) |
| 46 | map("n", "<F6>", function() | ||
| 47 | run_in_terminal("npm test") | ||
| 48 | end, opts) | ||
| 49 | map("n", "<F7>", function() | ||
| 50 | run_in_terminal("npm start") | ||
| 51 | end, opts) | ||
| 42 | end | 52 | end |
| 43 | 53 | ||
| 44 | if client then | 54 | if client then |
diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index edf2fc7..2c0226c 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua | |||
| @@ -7,7 +7,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then | |||
| 7 | if vim.v.shell_error ~= 0 then | 7 | if vim.v.shell_error ~= 0 then |
| 8 | vim.api.nvim_echo({ | 8 | vim.api.nvim_echo({ |
| 9 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, | 9 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, |
| 10 | { out, "WarningMsg" }, | 10 | { out, "WarningMsg" }, |
| 11 | { "\nPress any key to exit..." }, | 11 | { "\nPress any key to exit..." }, |
| 12 | }, true, {}) | 12 | }, true, {}) |
| 13 | vim.fn.getchar() | 13 | vim.fn.getchar() |
diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua index 848966b..1adcee0 100644 --- a/nvim/lua/config/options.lua +++ b/nvim/lua/config/options.lua | |||
| @@ -37,7 +37,7 @@ opt.listchars = { | |||
| 37 | trail = "-", | 37 | trail = "-", |
| 38 | extends = ">", | 38 | extends = ">", |
| 39 | precedes = "<", | 39 | precedes = "<", |
| 40 | nbsp = "+" | 40 | nbsp = "+", |
| 41 | } | 41 | } |
| 42 | opt.showbreak = "↪ " | 42 | opt.showbreak = "↪ " |
| 43 | 43 | ||
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 @@ | |||
| 1 | local M = {} | 1 | local M = {} |
| 2 | 2 | ||
| 3 | local modes = { | 3 | local modes = { |
| 4 | n = { "NORMAL", "StatuslineModeNormal" }, | 4 | n = { "NORMAL", "StatuslineModeNormal" }, |
| 5 | i = { "INSERT", "StatuslineModeInsert" }, | 5 | i = { "INSERT", "StatuslineModeInsert" }, |
| 6 | v = { "VISUAL", "StatuslineModeVisual" }, | 6 | v = { "VISUAL", "StatuslineModeVisual" }, |
| 7 | V = { "V-LINE", "StatuslineModeVisual" }, | 7 | V = { "V-LINE", "StatuslineModeVisual" }, |
| 8 | [""] = { "V-BLOCK", "StatuslineModeVisual" }, | 8 | [""] = { "V-BLOCK", "StatuslineModeVisual" }, |
| 9 | R = { "REPLACE", "StatuslineModeReplace" }, | 9 | R = { "REPLACE", "StatuslineModeReplace" }, |
| 10 | c = { "COMMAND", "StatuslineModeCommand" }, | 10 | c = { "COMMAND", "StatuslineModeCommand" }, |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | local function mode() | 13 | local function mode() |
| @@ -35,9 +35,7 @@ local function update_git_branch(bufnr) | |||
| 35 | return | 35 | return |
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | local branch = vim.fn.systemlist( | 38 | local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>/dev/null")[1] |
| 39 | "git rev-parse --abbrev-ref HEAD 2>/dev/null" | ||
| 40 | )[1] | ||
| 41 | 39 | ||
| 42 | if branch and branch ~= "" then | 40 | if branch and branch ~= "" then |
| 43 | vim.b[bufnr].git_branch = " " .. branch .. " " | 41 | vim.b[bufnr].git_branch = " " .. branch .. " " |
| @@ -50,14 +48,11 @@ end | |||
| 50 | -- Autocmd: Git nur bei Bedarf aktualisieren | 48 | -- Autocmd: Git nur bei Bedarf aktualisieren |
| 51 | ---------------------------------------------------------------------- | 49 | ---------------------------------------------------------------------- |
| 52 | 50 | ||
| 53 | vim.api.nvim_create_autocmd( | 51 | vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained" }, { |
| 54 | { "BufEnter", "FocusGained" }, | 52 | callback = function(args) |
| 55 | { | 53 | update_git_branch(args.buf) |
| 56 | callback = function(args) | 54 | end, |
| 57 | update_git_branch(args.buf) | 55 | }) |
| 58 | end, | ||
| 59 | } | ||
| 60 | ) | ||
| 61 | 56 | ||
| 62 | ---------------------------------------------------------------------- | 57 | ---------------------------------------------------------------------- |
| 63 | -- Statusline-Sektionen (reine Darstellung, keine IO) | 58 | -- Statusline-Sektionen (reine Darstellung, keine IO) |
| @@ -80,9 +75,7 @@ local function git_diff() | |||
| 80 | if gsd.changed and gsd.changed > 0 then table.insert(parts, "~" .. gsd.changed) end | 75 | if gsd.changed and gsd.changed > 0 then table.insert(parts, "~" .. gsd.changed) end |
| 81 | if gsd.removed and gsd.removed > 0 then table.insert(parts, "-" .. gsd.removed) end | 76 | if gsd.removed and gsd.removed > 0 then table.insert(parts, "-" .. gsd.removed) end |
| 82 | 77 | ||
| 83 | if #parts > 0 then | 78 | if #parts > 0 then return " " .. table.concat(parts, " ") .. " " end |
| 84 | return " " .. table.concat(parts, " ") .. " " | ||
| 85 | end | ||
| 86 | 79 | ||
| 87 | return "" | 80 | return "" |
| 88 | end | 81 | end |
| @@ -93,13 +86,9 @@ end | |||
| 93 | 86 | ||
| 94 | local function filename() | 87 | local function filename() |
| 95 | local name = vim.fn.expand("%:.") | 88 | local name = vim.fn.expand("%:.") |
| 96 | if name == "" then | 89 | if name == "" then name = "[No Name]" end |
| 97 | name = "[No Name]" | ||
| 98 | end | ||
| 99 | 90 | ||
| 100 | if vim.bo.modified then | 91 | if vim.bo.modified then name = name .. " [+]" end |
| 101 | name = name .. " [+]" | ||
| 102 | end | ||
| 103 | 92 | ||
| 104 | return " " .. name .. " " | 93 | return " " .. name .. " " |
| 105 | end | 94 | end |
| @@ -110,9 +99,7 @@ end | |||
| 110 | 99 | ||
| 111 | local function treesitter() | 100 | local function treesitter() |
| 112 | local ok = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] | 101 | local ok = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] |
| 113 | if ok then | 102 | if ok then return " 🌳 " end |
| 114 | return " 🌳 " | ||
| 115 | end | ||
| 116 | return "" | 103 | return "" |
| 117 | end | 104 | end |
| 118 | 105 | ||
| @@ -123,9 +110,9 @@ end | |||
| 123 | local function diagnostics() | 110 | local function diagnostics() |
| 124 | local counts = { | 111 | local counts = { |
| 125 | error = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }), | 112 | error = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }), |
| 126 | warn = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }), | 113 | warn = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN }), |
| 127 | info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }), | 114 | info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO }), |
| 128 | hint = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }), | 115 | hint = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT }), |
| 129 | } | 116 | } |
| 130 | 117 | ||
| 131 | local parts = {} | 118 | local parts = {} |
| @@ -135,9 +122,7 @@ local function diagnostics() | |||
| 135 | if counts.info > 0 then table.insert(parts, " " .. counts.info) end | 122 | if counts.info > 0 then table.insert(parts, " " .. counts.info) end |
| 136 | if counts.hint > 0 then table.insert(parts, " " .. counts.hint) end | 123 | if counts.hint > 0 then table.insert(parts, " " .. counts.hint) end |
| 137 | 124 | ||
| 138 | if #parts > 0 then | 125 | if #parts > 0 then return " " .. table.concat(parts, " ") .. " " end |
| 139 | return " " .. table.concat(parts, " ") .. " " | ||
| 140 | end | ||
| 141 | 126 | ||
| 142 | return "" | 127 | return "" |
| 143 | end | 128 | end |
| @@ -165,21 +150,13 @@ end | |||
| 165 | ------------------------------------------------------------------------- | 150 | ------------------------------------------------------------------------- |
| 166 | 151 | ||
| 167 | local function copilot() | 152 | local function copilot() |
| 168 | if vim.fn.exists("*copilot#Enabled") == 0 then | 153 | if vim.fn.exists("*copilot#Enabled") == 0 then return "" end |
| 169 | return "" | ||
| 170 | end | ||
| 171 | 154 | ||
| 172 | if vim.fn["copilot#Enabled"]() == 0 then | 155 | if vim.fn["copilot#Enabled"]() == 0 then return " OFF " end |
| 173 | return " OFF " | ||
| 174 | end | ||
| 175 | 156 | ||
| 176 | if vim.b.copilot_suggestion and vim.b.copilot_suggestion.is_visible then | 157 | if vim.b.copilot_suggestion and vim.b.copilot_suggestion.is_visible then return " SUG " end |
| 177 | return " SUG " | ||
| 178 | end | ||
| 179 | 158 | ||
| 180 | if vim.b.copilot_suggestion_auto_trigger == false then | 159 | if vim.b.copilot_suggestion_auto_trigger == false then return " MAN " end |
| 181 | return " MAN " | ||
| 182 | end | ||
| 183 | 160 | ||
| 184 | return " ON " | 161 | return " ON " |
| 185 | end | 162 | end |
diff --git a/nvim/lua/plugins/editing.lua b/nvim/lua/plugins/editing.lua index d1c3447..d2acd8e 100644 --- a/nvim/lua/plugins/editing.lua +++ b/nvim/lua/plugins/editing.lua | |||
| @@ -20,6 +20,6 @@ return { | |||
| 20 | 20 | ||
| 21 | { | 21 | { |
| 22 | "preservim/vim-markdown", | 22 | "preservim/vim-markdown", |
| 23 | ft = "markdown" | 23 | ft = "markdown", |
| 24 | }, | 24 | }, |
| 25 | } | 25 | } |
diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua index 3d6d5b0..9334465 100644 --- a/nvim/lua/plugins/format.lua +++ b/nvim/lua/plugins/format.lua | |||
| @@ -12,19 +12,19 @@ return { | |||
| 12 | }, | 12 | }, |
| 13 | opts = { | 13 | opts = { |
| 14 | formatters_by_ft = { | 14 | formatters_by_ft = { |
| 15 | awk = { "gawk" }, -- pkg install gawk | 15 | awk = { "gawk" }, -- pkg install gawk |
| 16 | bash = { "shfmt" }, | 16 | bash = { "shfmt" }, |
| 17 | c = {}, -- clangd | 17 | c = {}, -- clangd |
| 18 | cpp = {}, -- clangd | 18 | cpp = {}, -- clangd |
| 19 | javascript = { "prettier" }, | 19 | javascript = { "prettier" }, |
| 20 | json = { "jq" }, -- brew install jq, pkg install jq | 20 | json = { "jq" }, -- brew install jq, pkg install jq |
| 21 | lua = { "stylua" }, -- brew install stylua, pkg install stylua | 21 | lua = { "stylua" }, -- brew install stylua, pkg install stylua |
| 22 | python = { "ruff_format" }, -- brew install ruff, pkg install ruff | 22 | python = { "ruff_format" }, -- brew install ruff, pkg install ruff |
| 23 | sh = { "shfmt" }, -- brew install, pkg install shfmt | 23 | sh = { "shfmt" }, -- brew install, pkg install shfmt |
| 24 | typescript = { "prettier" }, -- npm install -g prettier | 24 | typescript = { "prettier" }, -- npm install -g prettier |
| 25 | xml = { "xmllint" }, -- xmllint ist Teil von libxml2 | 25 | xml = { "xmllint" }, -- xmllint ist Teil von libxml2 |
| 26 | xsd = { "xmllint" }, | 26 | xsd = { "xmllint" }, |
| 27 | yaml = { "yamlfmt" }, -- brew install yamlfmt, pkg install yamlfmt | 27 | yaml = { "yamlfmt" }, -- brew install yamlfmt, pkg install yamlfmt |
| 28 | }, | 28 | }, |
| 29 | default_format_opts = { | 29 | default_format_opts = { |
| 30 | lsp_format = "fallback", | 30 | lsp_format = "fallback", |
