From 6e5882a2fd02d30206ab9ca8aa5847b8ea09196c Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 12 Aug 2026 09:19:03 +0200 Subject: Normalize line endings --- nvim/lua/config/autocmds.lua | 86 +++++----- nvim/lua/config/colorscheme.lua | 34 ++-- nvim/lua/config/lazy.lua | 64 +++---- nvim/lua/config/statusline.lua | 364 ++++++++++++++++++++-------------------- nvim/lua/config/treesitter.lua | 56 +++---- nvim/lua/plugins/completion.lua | 92 +++++----- nvim/lua/plugins/editing.lua | 64 +++---- nvim/lua/plugins/format.lua | 92 +++++----- nvim/lua/plugins/git.lua | 32 ++-- nvim/lua/plugins/lsp.lua | 248 +++++++++++++-------------- nvim/lua/plugins/telescope.lua | 42 ++--- nvim/lua/plugins/treesitter.lua | 44 ++--- 12 files changed, 609 insertions(+), 609 deletions(-) (limited to 'nvim/lua') diff --git a/nvim/lua/config/autocmds.lua b/nvim/lua/config/autocmds.lua index 53bf7a9..58adafb 100644 --- a/nvim/lua/config/autocmds.lua +++ b/nvim/lua/config/autocmds.lua @@ -1,43 +1,43 @@ --- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/doc/nvim-treesitter.txt -local treesitter_languages = require("config.treesitter").languages - -local function enable_treesitter_features() - if not pcall(vim.treesitter.start) then return end - - vim.wo.foldmethod = "expr" - vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" - vim.bo.indentexpr = "v:lua.require('nvim-treesitter').indentexpr()" -end - -vim.api.nvim_create_autocmd("FileType", { - pattern = treesitter_languages, - callback = enable_treesitter_features, -}) - --- https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close -vim.api.nvim_create_autocmd("QuitPre", { - callback = function() - local invalid_win = {} - local wins = vim.api.nvim_list_wins() - - for _, w in ipairs(wins) do - local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w)) - if bufname:match("NvimTree_") ~= nil then table.insert(invalid_win, w) end - end - - if #invalid_win == #wins - 1 then - -- Should quit, so we close all invalid windows. - for _, w in ipairs(invalid_win) do - vim.api.nvim_win_close(w, true) - end - end - end, -}) - -vim.api.nvim_create_autocmd("LspAttach", { - callback = function(event) - local client = vim.lsp.get_client_by_id(event.data.client_id) - local keymaps = require("config.keymaps") - keymaps.lsp(event.buf, client) - end, -}) +-- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/doc/nvim-treesitter.txt +local treesitter_languages = require("config.treesitter").languages + +local function enable_treesitter_features() + if not pcall(vim.treesitter.start) then return end + + vim.wo.foldmethod = "expr" + vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.bo.indentexpr = "v:lua.require('nvim-treesitter').indentexpr()" +end + +vim.api.nvim_create_autocmd("FileType", { + pattern = treesitter_languages, + callback = enable_treesitter_features, +}) + +-- https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close +vim.api.nvim_create_autocmd("QuitPre", { + callback = function() + local invalid_win = {} + local wins = vim.api.nvim_list_wins() + + for _, w in ipairs(wins) do + local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w)) + if bufname:match("NvimTree_") ~= nil then table.insert(invalid_win, w) end + end + + if #invalid_win == #wins - 1 then + -- Should quit, so we close all invalid windows. + for _, w in ipairs(invalid_win) do + vim.api.nvim_win_close(w, true) + end + end + end, +}) + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(event) + local client = vim.lsp.get_client_by_id(event.data.client_id) + local keymaps = require("config.keymaps") + keymaps.lsp(event.buf, client) + end, +}) diff --git a/nvim/lua/config/colorscheme.lua b/nvim/lua/config/colorscheme.lua index 8d944c3..dfc8d24 100644 --- a/nvim/lua/config/colorscheme.lua +++ b/nvim/lua/config/colorscheme.lua @@ -1,17 +1,17 @@ --- Fix: Farbschema für Rechtschreibfehler -vim.api.nvim_set_hl(0, "SpellBad", { fg = "#ffffff", bg = "#5f0000" }) -vim.api.nvim_set_hl(0, "SpellCap", { fg = "#000000", bg = "#ffaf00" }) -vim.api.nvim_set_hl(0, "SpellRare", { fg = "#000000", bg = "#5fd7ff" }) -vim.api.nvim_set_hl(0, "SpellLocal", { fg = "#000000", bg = "#5fff87" }) -vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252526" }) - --- Statusline Farben -vim.api.nvim_set_hl(0, "StatuslineModeNormal", { fg = "#1e222a", bg = "#61afef", bold = true }) -vim.api.nvim_set_hl(0, "StatuslineModeInsert", { fg = "#1e222a", bg = "#98c379", bold = true }) -vim.api.nvim_set_hl(0, "StatuslineModeVisual", { fg = "#1e222a", bg = "#c678dd", bold = true }) -vim.api.nvim_set_hl(0, "StatuslineModeReplace", { fg = "#1e222a", bg = "#e86671", bold = true }) -vim.api.nvim_set_hl(0, "StatuslineModeCommand", { fg = "#1e222a", bg = "#e5c07b", bold = true }) - --- NVim-Tree -vim.api.nvim_set_hl(0, "NvimTreeOpenedFile", { bold = true }) -vim.api.nvim_set_hl(0, "NvimTreeCursorLine", { bg = "#2A2D2E" }) +-- Fix: Farbschema für Rechtschreibfehler +vim.api.nvim_set_hl(0, "SpellBad", { fg = "#ffffff", bg = "#5f0000" }) +vim.api.nvim_set_hl(0, "SpellCap", { fg = "#000000", bg = "#ffaf00" }) +vim.api.nvim_set_hl(0, "SpellRare", { fg = "#000000", bg = "#5fd7ff" }) +vim.api.nvim_set_hl(0, "SpellLocal", { fg = "#000000", bg = "#5fff87" }) +vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252526" }) + +-- Statusline Farben +vim.api.nvim_set_hl(0, "StatuslineModeNormal", { fg = "#1e222a", bg = "#61afef", bold = true }) +vim.api.nvim_set_hl(0, "StatuslineModeInsert", { fg = "#1e222a", bg = "#98c379", bold = true }) +vim.api.nvim_set_hl(0, "StatuslineModeVisual", { fg = "#1e222a", bg = "#c678dd", bold = true }) +vim.api.nvim_set_hl(0, "StatuslineModeReplace", { fg = "#1e222a", bg = "#e86671", bold = true }) +vim.api.nvim_set_hl(0, "StatuslineModeCommand", { fg = "#1e222a", bg = "#e5c07b", bold = true }) + +-- NVim-Tree +vim.api.nvim_set_hl(0, "NvimTreeOpenedFile", { bold = true }) +vim.api.nvim_set_hl(0, "NvimTreeCursorLine", { bg = "#2A2D2E" }) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index 76f59cb..972e777 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -1,32 +1,32 @@ --- https://lazy.folke.io/installation - -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.uv.fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - spec = { - { import = "plugins" }, - }, - checker = { - enabled = true, - notify = false, - frequency = 86400, -- Sekunden (1 Tag) - log = true, - }, - rocks = { - enabled = false, - }, -}) +-- https://lazy.folke.io/installation + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.uv.fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + checker = { + enabled = true, + notify = false, + frequency = 86400, -- Sekunden (1 Tag) + log = true, + }, + rocks = { + enabled = false, + }, +}) diff --git a/nvim/lua/config/statusline.lua b/nvim/lua/config/statusline.lua index 8a9c75a..3a6f1c7 100644 --- a/nvim/lua/config/statusline.lua +++ b/nvim/lua/config/statusline.lua @@ -1,182 +1,182 @@ -local M = {} - -local modes = { - n = { "NORMAL", "StatuslineModeNormal" }, - i = { "INSERT", "StatuslineModeInsert" }, - v = { "VISUAL", "StatuslineModeVisual" }, - V = { "V-LINE", "StatuslineModeVisual" }, - [""] = { "V-BLOCK", "StatuslineModeVisual" }, - R = { "REPLACE", "StatuslineModeReplace" }, - c = { "COMMAND", "StatuslineModeCommand" }, -} - -local function mode() - local m = vim.fn.mode() - local entry = modes[m] or { m, "StatusLine" } - return string.format("%%#%s# %s %%#StatusLine#", entry[2], entry[1]) -end - ----------------------------------------------------------------------- --- Git branch (buffer-lokal, gecached, kein redraw-spam) ----------------------------------------------------------------------- - --- /dev/null gibt es unter Windows nicht (cmd.exe versteht das nicht als --- Pfad und meldet "Das System kann den angegebenen Pfad nicht finden"). -local devnull = vim.fn.has("win32") == 1 and "NUL" or "/dev/null" - -local function update_git_branch(bufnr) - bufnr = bufnr or 0 - - -- nur in echten Dateien - if vim.bo[bufnr].buftype ~= "" then - vim.b[bufnr].git_branch = "" - return - end - - -- kein Git → nichts tun - if vim.fn.executable("git") ~= 1 then - vim.b[bufnr].git_branch = "" - return - end - - local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>" .. devnull)[1] - if branch then - -- unter Windows bleibt an systemlist()-Zeilen mitunter ein - -- trailing \r haengen (^M in der Statuszeile sichtbar) - branch = branch:gsub("\r$", "") - end - - if branch and branch ~= "" then - vim.b[bufnr].git_branch = "  " .. branch .. " " - else - vim.b[bufnr].git_branch = "" - end -end - ----------------------------------------------------------------------- --- Autocmd: Git nur bei Bedarf aktualisieren ----------------------------------------------------------------------- - -vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained" }, { - callback = function(args) - update_git_branch(args.buf) - end, -}) - ----------------------------------------------------------------------- --- Statusline-Sektionen (reine Darstellung, keine IO) ----------------------------------------------------------------------- - --- Git-Branch (buffer-lokal, gecached, kein redraw-spam) - -local function git() - return vim.b.git_branch or "" -end - --- Git-Diff (buffer-lokal, kein redraw-spam) - -local function git_diff() - local gsd = vim.b.gitsigns_status_dict - if not gsd then return "" end - - local parts = {} - if gsd.added and gsd.added > 0 then table.insert(parts, "+" .. gsd.added) end - 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 - - return "" -end - ----------------------------------------------------------------------- --- Dateiname mit Modifikationsstatus ----------------------------------------------------------------------- - -local function filename() - local name = vim.fn.expand("%:.") - if name == "" then name = "[No Name]" end - - if vim.bo.modified then name = name .. " [+]" end - - return " " .. name .. " " -end - ------------------------------------------------------------------------- --- Treesitter-Aktivität (buffer-lokal, kein redraw-spam) ------------------------------------------------------------------------- - -local function treesitter() - local ok = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] - if ok then return " 🌳 " end - return "" -end - ------------------------------------------------------------------------- --- Diagnostik-Counts (buffer-lokal, kein redraw-spam) ------------------------------------------------------------------------- - -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 }), - } - - local parts = {} - - if counts.error > 0 then table.insert(parts, "  " .. counts.error) end - if counts.warn > 0 then table.insert(parts, "  " .. counts.warn) end - 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 - - return "" -end - ------------------------------------------------------------------------- --- Filetype & Encoding (buffer-lokal, kein redraw-spam) ------------------------------------------------------------------------- - -local function fileinfo() - local ft = vim.bo.filetype ~= "" and vim.bo.filetype or "none" - local enc = vim.bo.fileencoding ~= "" and vim.bo.fileencoding or vim.o.encoding - return string.format(" %s %s ", ft, enc) -end - ------------------------------------------------------------------------- --- Cursor-Position (kein redraw-spam) ------------------------------------------------------------------------- - -local function position() - return string.format(" %d:%d ", vim.fn.line("."), vim.fn.col(".")) -end - ----------------------------------------------------------------------- --- Öffentliche Statusline-Funktion ----------------------------------------------------------------------- - -function M.statusline() - return table.concat({ - -- LEFT: Mode & Context - mode(), - "%#PmenuSel#", - git(), - git_diff(), - "%#StatusLine#", - filename(), - - "%=", - - -- RIGHT: Feedback & Meta - diagnostics(), - treesitter(), - fileinfo(), - " %p%% ", - position(), - }) -end - -return M +local M = {} + +local modes = { + n = { "NORMAL", "StatuslineModeNormal" }, + i = { "INSERT", "StatuslineModeInsert" }, + v = { "VISUAL", "StatuslineModeVisual" }, + V = { "V-LINE", "StatuslineModeVisual" }, + [""] = { "V-BLOCK", "StatuslineModeVisual" }, + R = { "REPLACE", "StatuslineModeReplace" }, + c = { "COMMAND", "StatuslineModeCommand" }, +} + +local function mode() + local m = vim.fn.mode() + local entry = modes[m] or { m, "StatusLine" } + return string.format("%%#%s# %s %%#StatusLine#", entry[2], entry[1]) +end + +---------------------------------------------------------------------- +-- Git branch (buffer-lokal, gecached, kein redraw-spam) +---------------------------------------------------------------------- + +-- /dev/null gibt es unter Windows nicht (cmd.exe versteht das nicht als +-- Pfad und meldet "Das System kann den angegebenen Pfad nicht finden"). +local devnull = vim.fn.has("win32") == 1 and "NUL" or "/dev/null" + +local function update_git_branch(bufnr) + bufnr = bufnr or 0 + + -- nur in echten Dateien + if vim.bo[bufnr].buftype ~= "" then + vim.b[bufnr].git_branch = "" + return + end + + -- kein Git → nichts tun + if vim.fn.executable("git") ~= 1 then + vim.b[bufnr].git_branch = "" + return + end + + local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD 2>" .. devnull)[1] + if branch then + -- unter Windows bleibt an systemlist()-Zeilen mitunter ein + -- trailing \r haengen (^M in der Statuszeile sichtbar) + branch = branch:gsub("\r$", "") + end + + if branch and branch ~= "" then + vim.b[bufnr].git_branch = "  " .. branch .. " " + else + vim.b[bufnr].git_branch = "" + end +end + +---------------------------------------------------------------------- +-- Autocmd: Git nur bei Bedarf aktualisieren +---------------------------------------------------------------------- + +vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained" }, { + callback = function(args) + update_git_branch(args.buf) + end, +}) + +---------------------------------------------------------------------- +-- Statusline-Sektionen (reine Darstellung, keine IO) +---------------------------------------------------------------------- + +-- Git-Branch (buffer-lokal, gecached, kein redraw-spam) + +local function git() + return vim.b.git_branch or "" +end + +-- Git-Diff (buffer-lokal, kein redraw-spam) + +local function git_diff() + local gsd = vim.b.gitsigns_status_dict + if not gsd then return "" end + + local parts = {} + if gsd.added and gsd.added > 0 then table.insert(parts, "+" .. gsd.added) end + 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 + + return "" +end + +---------------------------------------------------------------------- +-- Dateiname mit Modifikationsstatus +---------------------------------------------------------------------- + +local function filename() + local name = vim.fn.expand("%:.") + if name == "" then name = "[No Name]" end + + if vim.bo.modified then name = name .. " [+]" end + + return " " .. name .. " " +end + +------------------------------------------------------------------------ +-- Treesitter-Aktivität (buffer-lokal, kein redraw-spam) +------------------------------------------------------------------------ + +local function treesitter() + local ok = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] + if ok then return " 🌳 " end + return "" +end + +------------------------------------------------------------------------ +-- Diagnostik-Counts (buffer-lokal, kein redraw-spam) +------------------------------------------------------------------------ + +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 }), + } + + local parts = {} + + if counts.error > 0 then table.insert(parts, "  " .. counts.error) end + if counts.warn > 0 then table.insert(parts, "  " .. counts.warn) end + 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 + + return "" +end + +------------------------------------------------------------------------ +-- Filetype & Encoding (buffer-lokal, kein redraw-spam) +------------------------------------------------------------------------ + +local function fileinfo() + local ft = vim.bo.filetype ~= "" and vim.bo.filetype or "none" + local enc = vim.bo.fileencoding ~= "" and vim.bo.fileencoding or vim.o.encoding + return string.format(" %s %s ", ft, enc) +end + +------------------------------------------------------------------------ +-- Cursor-Position (kein redraw-spam) +------------------------------------------------------------------------ + +local function position() + return string.format(" %d:%d ", vim.fn.line("."), vim.fn.col(".")) +end + +---------------------------------------------------------------------- +-- Öffentliche Statusline-Funktion +---------------------------------------------------------------------- + +function M.statusline() + return table.concat({ + -- LEFT: Mode & Context + mode(), + "%#PmenuSel#", + git(), + git_diff(), + "%#StatusLine#", + filename(), + + "%=", + + -- RIGHT: Feedback & Meta + diagnostics(), + treesitter(), + fileinfo(), + " %p%% ", + position(), + }) +end + +return M diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua index 1eee267..d900e41 100644 --- a/nvim/lua/config/treesitter.lua +++ b/nvim/lua/config/treesitter.lua @@ -1,28 +1,28 @@ -local M = {} - --- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/SUPPORTED_LANGUAGES.md -M.languages = { - "bash", - "c", - "cpp", - "html", - "javascript", - "jq", - "json", - "lua", - "make", - "markdown", - "markdown_inline", - "po", - "powershell", - "prisma", - "python", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", - "zsh", -} - -return M +local M = {} + +-- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/SUPPORTED_LANGUAGES.md +M.languages = { + "bash", + "c", + "cpp", + "html", + "javascript", + "jq", + "json", + "lua", + "make", + "markdown", + "markdown_inline", + "po", + "powershell", + "prisma", + "python", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + "zsh", +} + +return M diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index 4912815..6e20d73 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -1,46 +1,46 @@ -return { - { - "saghen/blink.cmp", - dependencies = { "rafamadriz/friendly-snippets" }, - version = "1.*", - - opts = { - keymap = { preset = "default" }, - - appearance = { - use_nvim_cmp_as_default = true, - nerd_font_variant = "mono", - }, - - completion = { - documentation = { - auto_show = false, - window = { - border = "rounded", - }, - }, - - menu = { - border = "rounded", - }, - }, - - signature = { - enabled = true, - window = { - border = "rounded", - }, - }, - - sources = { - default = { "lsp", "path", "snippets", "buffer" }, - }, - - fuzzy = { - implementation = "prefer_rust_with_warning", - }, - }, - - opts_extend = { "sources.default" }, - }, -} +return { + { + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + + opts = { + keymap = { preset = "default" }, + + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = "mono", + }, + + completion = { + documentation = { + auto_show = false, + window = { + border = "rounded", + }, + }, + + menu = { + border = "rounded", + }, + }, + + signature = { + enabled = true, + window = { + border = "rounded", + }, + }, + + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + fuzzy = { + implementation = "prefer_rust_with_warning", + }, + }, + + opts_extend = { "sources.default" }, + }, +} diff --git a/nvim/lua/plugins/editing.lua b/nvim/lua/plugins/editing.lua index b9f9283..38e651c 100644 --- a/nvim/lua/plugins/editing.lua +++ b/nvim/lua/plugins/editing.lua @@ -1,32 +1,32 @@ -return { - { - "tpope/vim-repeat", - event = "VeryLazy", - }, - - { - "tpope/vim-surround", -- alternative: "kylechui/nvim-surround" - event = "VeryLazy", - }, - - { - "romainl/vim-cool", - event = "VeryLazy", - }, - - { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = true, - }, - - { - "windwp/nvim-ts-autotag", - event = "InsertEnter", - }, - - { - "preservim/vim-markdown", - ft = "markdown", - }, -} +return { + { + "tpope/vim-repeat", + event = "VeryLazy", + }, + + { + "tpope/vim-surround", -- alternative: "kylechui/nvim-surround" + event = "VeryLazy", + }, + + { + "romainl/vim-cool", + event = "VeryLazy", + }, + + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + }, + + { + "windwp/nvim-ts-autotag", + event = "InsertEnter", + }, + + { + "preservim/vim-markdown", + ft = "markdown", + }, +} diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua index 8ca7f1b..102326c 100644 --- a/nvim/lua/plugins/format.lua +++ b/nvim/lua/plugins/format.lua @@ -1,46 +1,46 @@ --- 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" }, - 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, - json = jq, - lua = stylua, - python = ruff, - sh = shfmt, - typescript = prettier, - xml = xmllint, - xsd = xmllint, - yaml = yamlfmt, - }, - default_format_opts = { - lsp_format = "fallback", - }, - }, -} +-- 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" }, + 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, + json = jq, + lua = stylua, + python = ruff, + sh = shfmt, + typescript = prettier, + xml = xmllint, + xsd = xmllint, + yaml = yamlfmt, + }, + default_format_opts = { + lsp_format = "fallback", + }, + }, +} diff --git a/nvim/lua/plugins/git.lua b/nvim/lua/plugins/git.lua index ed7bafe..37d5ee3 100644 --- a/nvim/lua/plugins/git.lua +++ b/nvim/lua/plugins/git.lua @@ -1,16 +1,16 @@ -return { - { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - opts = { - current_line_blame = true, - current_line_blame_opts = { - delay = 250, - }, - }, - config = function(_, opts) - require("gitsigns").setup(opts) - require("config.keymaps").gitsigns() - end, - }, -} +return { + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 250, + }, + }, + config = function(_, opts) + require("gitsigns").setup(opts) + require("config.keymaps").gitsigns() + end, + }, +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index b301b68..812ed24 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -1,124 +1,124 @@ -return { - { - "neovim/nvim-lspconfig", - dependencies = { "saghen/blink.cmp" }, - lazy = false, - config = function() - local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) - - vim.lsp.config.lua_ls = { - capabilities = capabilities, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - }, - diagnostics = { - globals = { "vim" }, - }, - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME .. "/lua", - vim.fn.stdpath("config") .. "/lua", - }, - }, - telemetry = { - enable = false, - }, - }, - }, - } - - vim.lsp.config.bashls = { - capabilities = capabilities, - filetypes = { "sh", "bash" }, - } - - vim.lsp.config.clangd = { - capabilities = capabilities, - cmd = { - "clangd", - "--background-index", - "--clang-tidy", - "--completion-style=detailed", - "--header-insertion=iwyu", - "--header-insertion-decorators", - "--pch-storage=memory", - "--all-scopes-completion", - "--inlay-hints", - "--function-arg-placeholders", - "--fallback-style=llvm", - }, - } - - vim.lsp.config.prismals = { - capabilities = capabilities, - } - - vim.lsp.config.jsonls = { - capabilities = capabilities, - } - - vim.lsp.config.html = { - capabilities = capabilities, - } - - vim.lsp.config.vtsls = { - capabilities = capabilities, - settings = { - typescript = { - updateImportsOnFileMove = { enabled = "always" }, - suggest = { - completeFunctionCalls = true, - }, - inlayHints = { - enumMemberValues = { enabled = true }, - functionLikeReturnTypes = { enabled = true }, - parameterNames = { enabled = "all" }, - parameterTypes = { enabled = true }, - propertyDeclarationTypes = { enabled = true }, - variableTypes = { enabled = false }, - }, - }, - javascript = { - suggest = { - completeFunctionCalls = true, - }, - inlayHints = { - parameterNames = { enabled = "all" }, - }, - }, - }, - } - - vim.lsp.config.basedpyright = { - capabilities = capabilities, - settings = { - basedpyright = { - analysis = { - diagnosticMode = "openFilesOnly", - inlayHints = { - callArgumentNames = true, - }, - typeCheckingMode = "basic", -- oder "strict" für strenger - autoSearchPaths = true, - useLibraryCodeForTypes = true, - }, - }, - }, - } - - vim.lsp.enable({ - "basedpyright", -- npm install -g basedpyright, brew install basedpyright - "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck - "clangd", -- pkg install llvm - "html", -- npm install -g vscode-langservers-extracted - "jsonls", -- npm install -g vscode-langservers-extracted - "lua_ls", -- pkg install lua-language-server, brew install lua-language-server - "prismals", -- npm install -g @prisma/language-server - "vtsls", -- npm install -g @vtsls/language-server - }) - end, - }, -} +return { + { + "neovim/nvim-lspconfig", + dependencies = { "saghen/blink.cmp" }, + lazy = false, + config = function() + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) + + vim.lsp.config.lua_ls = { + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + }, + diagnostics = { + globals = { "vim" }, + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME .. "/lua", + vim.fn.stdpath("config") .. "/lua", + }, + }, + telemetry = { + enable = false, + }, + }, + }, + } + + vim.lsp.config.bashls = { + capabilities = capabilities, + filetypes = { "sh", "bash" }, + } + + vim.lsp.config.clangd = { + capabilities = capabilities, + cmd = { + "clangd", + "--background-index", + "--clang-tidy", + "--completion-style=detailed", + "--header-insertion=iwyu", + "--header-insertion-decorators", + "--pch-storage=memory", + "--all-scopes-completion", + "--inlay-hints", + "--function-arg-placeholders", + "--fallback-style=llvm", + }, + } + + vim.lsp.config.prismals = { + capabilities = capabilities, + } + + vim.lsp.config.jsonls = { + capabilities = capabilities, + } + + vim.lsp.config.html = { + capabilities = capabilities, + } + + vim.lsp.config.vtsls = { + capabilities = capabilities, + settings = { + typescript = { + updateImportsOnFileMove = { enabled = "always" }, + suggest = { + completeFunctionCalls = true, + }, + inlayHints = { + enumMemberValues = { enabled = true }, + functionLikeReturnTypes = { enabled = true }, + parameterNames = { enabled = "all" }, + parameterTypes = { enabled = true }, + propertyDeclarationTypes = { enabled = true }, + variableTypes = { enabled = false }, + }, + }, + javascript = { + suggest = { + completeFunctionCalls = true, + }, + inlayHints = { + parameterNames = { enabled = "all" }, + }, + }, + }, + } + + vim.lsp.config.basedpyright = { + capabilities = capabilities, + settings = { + basedpyright = { + analysis = { + diagnosticMode = "openFilesOnly", + inlayHints = { + callArgumentNames = true, + }, + typeCheckingMode = "basic", -- oder "strict" für strenger + autoSearchPaths = true, + useLibraryCodeForTypes = true, + }, + }, + }, + } + + vim.lsp.enable({ + "basedpyright", -- npm install -g basedpyright, brew install basedpyright + "bashls", -- npm install -g bash-language-server, pkg install hs-ShellCheck + "clangd", -- pkg install llvm + "html", -- npm install -g vscode-langservers-extracted + "jsonls", -- npm install -g vscode-langservers-extracted + "lua_ls", -- pkg install lua-language-server, brew install lua-language-server + "prismals", -- npm install -g @prisma/language-server + "vtsls", -- npm install -g @vtsls/language-server + }) + end, + }, +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index d7fd279..d4e3fd3 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -1,21 +1,21 @@ -return { - { - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - lazy = true, - opts = { - defaults = { - path_display = { "smart", "truncate" }, - }, - }, - keys = { - { "ff", "Telescope find_files", desc = "Find files" }, - { "fg", "Telescope live_grep", desc = "Live grep" }, - { "fb", "Telescope buffers", desc = "Buffers" }, - { "fh", "Telescope help_tags", desc = "Help tags" }, - { "dd", "Telescope diagnostics", desc = "Diagnostics" }, - }, - }, -} +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + lazy = true, + opts = { + defaults = { + path_display = { "smart", "truncate" }, + }, + }, + keys = { + { "ff", "Telescope find_files", desc = "Find files" }, + { "fg", "Telescope live_grep", desc = "Live grep" }, + { "fb", "Telescope buffers", desc = "Buffers" }, + { "fh", "Telescope help_tags", desc = "Help tags" }, + { "dd", "Telescope diagnostics", desc = "Diagnostics" }, + }, + }, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index faa850a..954e05f 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -1,22 +1,22 @@ --- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/README.md - --- Stelle sicher, dass die TreeSitter-CLI installiert ist: --- MacOS: `brew install tree-sitter-cli` --- FreeBSD: `doas pkg install tree-sitter-cli` - -return { - { - "nvim-treesitter/nvim-treesitter", - branch = "main", - build = ":TSUpdate", - lazy = false, - opts = {}, - config = function(_, opts) - local treesitter = require("nvim-treesitter") - local langs = require("config.treesitter").languages - - treesitter.setup(opts) - treesitter.install(langs) - end, - }, -} +-- https://github.com/nvim-treesitter/nvim-treesitter/blob/main/README.md + +-- Stelle sicher, dass die TreeSitter-CLI installiert ist: +-- MacOS: `brew install tree-sitter-cli` +-- FreeBSD: `doas pkg install tree-sitter-cli` + +return { + { + "nvim-treesitter/nvim-treesitter", + branch = "main", + build = ":TSUpdate", + lazy = false, + opts = {}, + config = function(_, opts) + local treesitter = require("nvim-treesitter") + local langs = require("config.treesitter").languages + + treesitter.setup(opts) + treesitter.install(langs) + end, + }, +} -- cgit v1.3