From 56fde6f21044db8e4bd7ab2e6d3d7612a6ab9941 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sun, 14 Jun 2026 09:13:57 +0200 Subject: [PATCH] fix: get configs working --- nvim/lua/lazy-conf.lua | 2 +- nvim/lua/lsp-options.lua | 21 --- nvim/lua/plugins/snacks/init.lua | 2 +- nvim/lua/plugins/snacks/{ => keys}/keys.lua | 93 +++++++----- nvim/lua/plugins/style/todo-comments.lua | 154 +++++++++++--------- 5 files changed, 144 insertions(+), 128 deletions(-) rename nvim/lua/plugins/snacks/{ => keys}/keys.lua (78%) diff --git a/nvim/lua/lazy-conf.lua b/nvim/lua/lazy-conf.lua index 421d24b..554f209 100755 --- a/nvim/lua/lazy-conf.lua +++ b/nvim/lua/lazy-conf.lua @@ -14,10 +14,10 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { import = "plugins.nav" }, + { import = "plugins.snacks" }, { import = "plugins.lsp" }, { import = "plugins.style" }, { import = "plugins.util" }, - { import = "plugins.util.diff" }, { import = "plugins.testing" }, }, change_detection = { diff --git a/nvim/lua/lsp-options.lua b/nvim/lua/lsp-options.lua index 8157af1..7851027 100644 --- a/nvim/lua/lsp-options.lua +++ b/nvim/lua/lsp-options.lua @@ -8,21 +8,6 @@ M.on_attach = function(client, bufnr) opts.buffer = bufnr -- set keybinds - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) - - opts.desc = "Go to declaration" - keymap.set("n", "gD", ":lua vim.lsp.buf.declaration", opts) - - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) - - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) - - opts.desc = "Show LSP type definitions" - keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) - opts.desc = "See available code actions" keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) @@ -32,12 +17,6 @@ M.on_attach = function(client, bufnr) opts.desc = "Smart rename" keymap.set("n", "n", vim.lsp.buf.rename, opts) - opts.desc = "Show buffer diagnostics" - keymap.set("n", "ga", "Telescope diagnostics bufnr=0", opts) - - opts.desc = "Show line diagnostics" - keymap.set("n", "gA", ":lua vim.diagnostic.open_float()", opts) - opts.desc = "Go to previous diagnostic" keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) diff --git a/nvim/lua/plugins/snacks/init.lua b/nvim/lua/plugins/snacks/init.lua index 7c61c85..2b53c4c 100644 --- a/nvim/lua/plugins/snacks/init.lua +++ b/nvim/lua/plugins/snacks/init.lua @@ -28,5 +28,5 @@ return { statuscolumn = { enabled = true }, scope = { enabled = true }, }, - keys = require("plugins.snacks.keys"), + keys = require("plugins.snacks.keys.keys"), } diff --git a/nvim/lua/plugins/snacks/keys.lua b/nvim/lua/plugins/snacks/keys/keys.lua similarity index 78% rename from nvim/lua/plugins/snacks/keys.lua rename to nvim/lua/plugins/snacks/keys/keys.lua index 07a030a..75ed085 100644 --- a/nvim/lua/plugins/snacks/keys.lua +++ b/nvim/lua/plugins/snacks/keys/keys.lua @@ -39,7 +39,7 @@ return { Snacks.picker.icons() end, desc = "Show icons", - mode = "n" + mode = "n", }, -- Terminal { @@ -56,7 +56,7 @@ return { Snacks.explorer() end, desc = "Open File Tree", - mode = "n" + mode = "n", }, -- Pickers { @@ -65,7 +65,7 @@ return { Snacks.picker.files() end, desc = "Find file", - mode = "n" + mode = "n", }, { "fg", @@ -73,7 +73,7 @@ return { Snacks.picker.grep() end, desc = "Find file content using grep", - mode = "n" + mode = "n", }, { "fb", @@ -81,7 +81,7 @@ return { Snacks.picker.buffers() end, desc = "Show all buffers", - mode = "n" + mode = "n", }, { "fch", @@ -89,7 +89,7 @@ return { Snacks.picker.command_history() end, desc = "Show command history", - mode = "n" + mode = "n", }, { "fd", @@ -97,7 +97,7 @@ return { Snacks.picker.diagnostics() end, desc = "Show diagnostics", - mode = "n" + mode = "n", }, { "fm", @@ -105,7 +105,7 @@ return { Snacks.picker.git_diff() end, desc = "Show uncommitted diffs", - mode = "n" + mode = "n", }, { "fh", @@ -113,7 +113,7 @@ return { Snacks.picker.help() end, desc = "Show nvim help pages", - mode = "n" + mode = "n", }, { "fj", @@ -121,7 +121,7 @@ return { Snacks.picker.jumps() end, desc = "Show available jumps", - mode = "n" + mode = "n", }, { "fk", @@ -129,7 +129,7 @@ return { Snacks.picker.keymaps() end, desc = "Show keymaps", - mode = "n" + mode = "n", }, { "flc", @@ -137,47 +137,68 @@ return { Snacks.picker.lsp_config() end, desc = "Show LSP configs", - mode = "n" + mode = "n", }, { - "fld", + "gd", function() Snacks.picker.lsp_definitions() end, - desc = "Show LSP definitions (alias for gd)", - mode = "n" + desc = "Goto definitions", + mode = "n", }, { - "fli", + "gi", function() Snacks.picker.lsp_implementations() end, - desc = "Show LSP implementations (alias for gi)", - mode = "n" + desc = "Goto implementations", + mode = "n", }, { - "flr", + "gR", function() Snacks.picker.lsp_references() end, - desc = "Show LSP references (alias for gR)", - mode = "n" + desc = "Goto references", + mode = "n", }, { - "fls", + "gD", + function() + Snacks.picker.lsp_declarations() + end, + desc = "Goto declaration", + mode = "n", + }, + { + "gy", + function() + Snacks.picker.lsp_type_definitions() + end, + desc = "Goto T[y]pe Definition", + }, + { + "gai", + function() + Snacks.picker.lsp_incoming_calls() + end, + desc = "C[a]lls Incoming", + }, + { + "gao", + function() + Snacks.picker.lsp_outgoing_calls() + end, + desc = "C[a]lls Outgoing", + }, + { + "gs", function() Snacks.picker.lsp_symbols() end, desc = "Show LSP symbols", - mode = "n" - }, - { - "flt", - function() - Snacks.picker.lsp_type_definitions() - end, - desc = "Show LSP type definitions", - mode = "n" + mode = "n", }, { "fn", @@ -185,7 +206,7 @@ return { Snacks.picker.notifications() end, desc = "Show notifications", - mode = "n" + mode = "n", }, { "fp", @@ -193,7 +214,7 @@ return { Snacks.picker.projects() end, desc = "Show recent projects", - mode = "n" + mode = "n", }, { "fr", @@ -201,7 +222,7 @@ return { Snacks.picker.recent() end, desc = "Show recent files", - mode = "n" + mode = "n", }, { "fs", @@ -209,7 +230,7 @@ return { Snacks.picker.spelling() end, desc = "Show spelling suggestions", - mode = "n" + mode = "n", }, { "fo", @@ -217,7 +238,7 @@ return { Snacks.picker.treesitter() end, desc = "Show treesitter details", - mode = "n" + mode = "n", }, -- Close buffer { diff --git a/nvim/lua/plugins/style/todo-comments.lua b/nvim/lua/plugins/style/todo-comments.lua index 5e1851e..ff36ac7 100644 --- a/nvim/lua/plugins/style/todo-comments.lua +++ b/nvim/lua/plugins/style/todo-comments.lua @@ -1,71 +1,87 @@ return { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - event = "BufRead", - opts = { - { - signs = true, -- show icons in the signs column - sign_priority = 8, -- sign priority - -- keywords recognized as todo comments - keywords = { - FIX = { - icon = " ", -- icon used for the sign, and in search results - color = "error", -- can be a hex color, or a named color (see below) - alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords - -- signs = false, -- configure signs for some keywords individually - }, - TODO = { icon = " ", color = "todo" }, - HACK = { icon = " ", color = "warning" }, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, - TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - }, - gui_style = { - fg = "NONE", -- The gui style to use for the fg highlight group. - bg = "BOLD", -- The gui style to use for the bg highlight group. - }, - merge_keywords = true, -- when true, custom keywords will be merged with the defaults - -- highlighting of the line containing the todo comment - -- * before: highlights before the keyword (typically comment characters) - -- * keyword: highlights of the keyword - -- * after: highlights after the keyword (todo text) - highlight = { - multiline = true, -- enable multine todo comments - multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword - multiline_context = 10, -- extra lines that will be re-evaluated when changing a line - before = "", -- "fg" or "bg" or empty - keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) - after = "fg", -- "fg" or "bg" or empty - pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) - comments_only = true, -- uses treesitter to match keywords in comments only - max_line_len = 400, -- ignore lines longer than this - exclude = {}, -- list of file types to exclude highlighting - }, - -- list of named colors where we try to extract the guifg from the - -- list of highlight groups or use the hex color if hl not found as a fallback - colors = { - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, - todo = { "DiagnosticInfo", "#2563EB" }, - hint = { "DiagnosticHint", "#10B981" }, - default = { "Identifier", "#7C3AED" }, - test = { "Identifier", "#FF00FF" }, - }, - search = { - command = "rg", - args = { - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - }, - -- regex that will be used to match keywords. - -- don't replace the (KEYWORDS) placeholder - pattern = [[\b(KEYWORDS):]], -- ripgrep regex - -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives - }, - }, - }, + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + event = "BufRead", + opts = { + { + signs = true, -- show icons in the signs column + sign_priority = 8, -- sign priority + -- keywords recognized as todo comments + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "todo" }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + gui_style = { + fg = "NONE", -- The gui style to use for the fg highlight group. + bg = "BOLD", -- The gui style to use for the bg highlight group. + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + -- highlighting of the line containing the todo comment + -- * before: highlights before the keyword (typically comment characters) + -- * keyword: highlights of the keyword + -- * after: highlights after the keyword (todo text) + highlight = { + multiline = true, -- enable multine todo comments + multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = "", -- "fg" or "bg" or empty + keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = "fg", -- "fg" or "bg" or empty + pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting + }, + -- list of named colors where we try to extract the guifg from the + -- list of highlight groups or use the hex color if hl not found as a fallback + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + todo = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" }, + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + -- regex that will be used to match keywords. + -- don't replace the (KEYWORDS) placeholder + pattern = [[\b(KEYWORDS):]], -- ripgrep regex + -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives + }, + }, + }, + keys = { + { + "ft", + function() + Snacks.picker.todo_comments() + end, + desc = "Todo", + }, + { + "fT", + function() + Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) + end, + desc = "Todo/Fix/Fixme", + }, + }, }