From 2dad06edd89ee4353027142dd909c03faae8020d Mon Sep 17 00:00:00 2001 From: Tim Huizinga Date: Fri, 13 Mar 2026 17:12:35 +0100 Subject: [PATCH] Added gitlab review plugin --- nvim/dot-config/nvim/lazy-lock.json | 2 + nvim/dot-config/nvim/lua/lsp.lua | 28 +- nvim/dot-config/nvim/lua/plugins/diffview.lua | 412 ++++++++++++++++++ nvim/dot-config/nvim/lua/plugins/gitlab.lua | 39 ++ 4 files changed, 467 insertions(+), 14 deletions(-) create mode 100644 nvim/dot-config/nvim/lua/plugins/diffview.lua create mode 100644 nvim/dot-config/nvim/lua/plugins/gitlab.lua diff --git a/nvim/dot-config/nvim/lazy-lock.json b/nvim/dot-config/nvim/lazy-lock.json index 155da4e..a9a96c3 100644 --- a/nvim/dot-config/nvim/lazy-lock.json +++ b/nvim/dot-config/nvim/lazy-lock.json @@ -6,9 +6,11 @@ "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, "conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" }, "crates.nvim": { "branch": "main", "commit": "afcd1cc3eeceb5783676fc8464389b9216a29d05" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" }, "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitlab.nvim": { "branch": "develop", "commit": "3d2828a9504b87fc36ee2aca1b0f36cf75003edd" }, "gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" }, "gruvbox.nvim": { "branch": "main", "commit": "334d5fd49fc8033f26408425366c66c6390c57bb" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, diff --git a/nvim/dot-config/nvim/lua/lsp.lua b/nvim/dot-config/nvim/lua/lsp.lua index a3a0c1d..79c5318 100644 --- a/nvim/dot-config/nvim/lua/lsp.lua +++ b/nvim/dot-config/nvim/lua/lsp.lua @@ -75,20 +75,20 @@ local function on_attach(client, bufnr) end -- Highlight references under cursor - if client:supports_method(methods.textDocument_documentHighlight) then - local lsp_hover_hl = vim.api.nvim_create_augroup("LspHoverHighlight", { clear = false }) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = bufnr, - group = lsp_hover_hl, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = bufnr, - group = lsp_hover_hl, - callback = vim.lsp.buf.clear_references, - }) - end + -- if client:supports_method(methods.textDocument_documentHighlight) then + -- local lsp_hover_hl = vim.api.nvim_create_augroup("LspHoverHighlight", { clear = false }) + -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + -- buffer = bufnr, + -- group = lsp_hover_hl, + -- callback = vim.lsp.buf.document_highlight, + -- }) + -- + -- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + -- buffer = bufnr, + -- group = lsp_hover_hl, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- end end vim.diagnostic.config({ diff --git a/nvim/dot-config/nvim/lua/plugins/diffview.lua b/nvim/dot-config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..e5a5656 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,412 @@ +-- https://github.com/sindrets/diffview.nvim +--- @module "lazy" +--- @type LazySpec +return { + "sindrets/diffview.nvim", + opts = function() + local actions = require("diffview.actions") + + return { + use_icons = false, + -- Disable default keymaps just so we can change e -> f + keymaps = { + disable_defaults = true, + view = { + -- The `view` bindings are active in the diff buffers, only when the current + -- tabpage is a Diffview. + { + "n", + "", + actions.select_next_entry, + { desc = "Open the diff for the next file" }, + }, + { + "n", + "", + actions.select_prev_entry, + { desc = "Open the diff for the previous file" }, + }, + { + "n", + "[F", + actions.select_first_entry, + { desc = "Open the diff for the first file" }, + }, + { + "n", + "]F", + actions.select_last_entry, + { desc = "Open the diff for the last file" }, + }, + { + "n", + "gf", + actions.goto_file_edit, + { desc = "Open the file in the previous tabpage" }, + }, + { "n", "", actions.goto_file_split, { desc = "Open the file in a new split" } }, + { "n", "gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } }, + { "n", "f", actions.focus_files, { desc = "Bring focus to the file panel" } }, + { "n", "b", actions.toggle_files, { desc = "Toggle the file panel." } }, + { + "n", + "g", + actions.cycle_layout, + { desc = "Cycle through available layouts." }, + }, + { + "n", + "[x", + actions.prev_conflict, + { desc = "In the merge-tool: jump to the previous conflict" }, + }, + { + "n", + "]x", + actions.next_conflict, + { desc = "In the merge-tool: jump to the next conflict" }, + }, + { + "n", + "co", + actions.conflict_choose("ours"), + { desc = "Choose the OURS version of a conflict" }, + }, + { + "n", + "ct", + actions.conflict_choose("theirs"), + { desc = "Choose the THEIRS version of a conflict" }, + }, + { + "n", + "cb", + actions.conflict_choose("base"), + { desc = "Choose the BASE version of a conflict" }, + }, + { + "n", + "ca", + actions.conflict_choose("all"), + { desc = "Choose all the versions of a conflict" }, + }, + { "n", "dx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } }, + { + "n", + "cO", + actions.conflict_choose_all("ours"), + { desc = "Choose the OURS version of a conflict for the whole file" }, + }, + { + "n", + "cT", + actions.conflict_choose_all("theirs"), + { desc = "Choose the THEIRS version of a conflict for the whole file" }, + }, + { + "n", + "cB", + actions.conflict_choose_all("base"), + { desc = "Choose the BASE version of a conflict for the whole file" }, + }, + { + "n", + "cA", + actions.conflict_choose_all("all"), + { desc = "Choose all the versions of a conflict for the whole file" }, + }, + { + "n", + "dX", + actions.conflict_choose_all("none"), + { desc = "Delete the conflict region for the whole file" }, + }, + }, + file_panel = { + { + "n", + "j", + actions.next_entry, + { desc = "Bring the cursor to the next file entry" }, + }, + { + "n", + "", + actions.next_entry, + { desc = "Bring the cursor to the next file entry" }, + }, + { + "n", + "k", + actions.prev_entry, + { desc = "Bring the cursor to the previous file entry" }, + }, + { + "n", + "", + actions.prev_entry, + { desc = "Bring the cursor to the previous file entry" }, + }, + { + "n", + "", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "o", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "l", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "<2-LeftMouse>", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "-", + actions.toggle_stage_entry, + { desc = "Stage / unstage the selected entry" }, + }, + { + "n", + "s", + actions.toggle_stage_entry, + { desc = "Stage / unstage the selected entry" }, + }, + { "n", "S", actions.stage_all, { desc = "Stage all entries" } }, + { "n", "U", actions.unstage_all, { desc = "Unstage all entries" } }, + { + "n", + "X", + actions.restore_entry, + { desc = "Restore entry to the state on the left side" }, + }, + { "n", "L", actions.open_commit_log, { desc = "Open the commit log panel" } }, + { "n", "zo", actions.open_fold, { desc = "Expand fold" } }, + { "n", "h", actions.close_fold, { desc = "Collapse fold" } }, + { "n", "zc", actions.close_fold, { desc = "Collapse fold" } }, + { "n", "za", actions.toggle_fold, { desc = "Toggle fold" } }, + { "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } }, + { "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } }, + { "n", "", actions.scroll_view(-0.25), { desc = "Scroll the view up" } }, + { "n", "", actions.scroll_view(0.25), { desc = "Scroll the view down" } }, + { + "n", + "", + actions.select_next_entry, + { desc = "Open the diff for the next file" }, + }, + { + "n", + "", + actions.select_prev_entry, + { desc = "Open the diff for the previous file" }, + }, + { + "n", + "[F", + actions.select_first_entry, + { desc = "Open the diff for the first file" }, + }, + { + "n", + "]F", + actions.select_last_entry, + { desc = "Open the diff for the last file" }, + }, + { + "n", + "gf", + actions.goto_file_edit, + { desc = "Open the file in the previous tabpage" }, + }, + { + "n", + "", + actions.goto_file_split, + { desc = "Open the file in a new split" }, + }, + { + "n", + "gf", + actions.goto_file_tab, + { desc = "Open the file in a new tabpage" }, + }, + { + "n", + "i", + actions.listing_style, + { desc = "Toggle between 'list' and 'tree' views" }, + }, + { + "n", + "f", + actions.toggle_flatten_dirs, + { desc = "Flatten empty subdirectories in tree listing style" }, + }, + { + "n", + "R", + actions.refresh_files, + { desc = "Update stats and entries in the file list" }, + }, + { + "n", + "f", + actions.focus_files, + { desc = "Bring focus to the file panel" }, + }, + { "n", "b", actions.toggle_files, { desc = "Toggle the file panel" } }, + { "n", "g", actions.cycle_layout, { desc = "Cycle available layouts" } }, + { "n", "[x", actions.prev_conflict, { desc = "Go to the previous conflict" } }, + { "n", "]x", actions.next_conflict, { desc = "Go to the next conflict" } }, + { "n", "g?", actions.help("file_panel"), { desc = "Open the help panel" } }, + { + "n", + "cO", + actions.conflict_choose_all("ours"), + { desc = "Choose the OURS version of a conflict for the whole file" }, + }, + { + "n", + "cT", + actions.conflict_choose_all("theirs"), + { desc = "Choose the THEIRS version of a conflict for the whole file" }, + }, + { + "n", + "cB", + actions.conflict_choose_all("base"), + { desc = "Choose the BASE version of a conflict for the whole file" }, + }, + { + "n", + "cA", + actions.conflict_choose_all("all"), + { desc = "Choose all the versions of a conflict for the whole file" }, + }, + { + "n", + "dX", + actions.conflict_choose_all("none"), + { desc = "Delete the conflict region for the whole file" }, + }, + }, + file_history_panel = { + { "n", "g!", actions.options, { desc = "Open the option panel" } }, + { + "n", + "", + actions.open_in_diffview, + { desc = "Open the entry under the cursor in a diffview" }, + }, + { + "n", + "y", + actions.copy_hash, + { desc = "Copy the commit hash of the entry under the cursor" }, + }, + { "n", "L", actions.open_commit_log, { desc = "Show commit details" } }, + { + "n", + "X", + actions.restore_entry, + { desc = "Restore file to the state from the selected entry" }, + }, + { "n", "zo", actions.open_fold, { desc = "Expand fold" } }, + { "n", "zc", actions.close_fold, { desc = "Collapse fold" } }, + { "n", "h", actions.close_fold, { desc = "Collapse fold" } }, + { "n", "za", actions.toggle_fold, { desc = "Toggle fold" } }, + { "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } }, + { "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } }, + { + "n", + "j", + actions.next_entry, + { desc = "Bring the cursor to the next file entry" }, + }, + { + "n", + "", + actions.next_entry, + { desc = "Bring the cursor to the next file entry" }, + }, + { + "n", + "k", + actions.prev_entry, + { desc = "Bring the cursor to the previous file entry" }, + }, + { + "n", + "", + actions.prev_entry, + { desc = "Bring the cursor to the previous file entry" }, + }, + { + "n", + "", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "o", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "l", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { + "n", + "<2-LeftMouse>", + actions.select_entry, + { desc = "Open the diff for the selected entry" }, + }, + { "n", "", actions.scroll_view(-0.25), { desc = "Scroll the view up" } }, + { "n", "", actions.scroll_view(0.25), { desc = "Scroll the view down" } }, + { "n", "", actions.select_next_entry, { desc = "Open the diff for the next file" } }, + { + "n", + "", + actions.select_prev_entry, + { desc = "Open the diff for the previous file" }, + }, + { + "n", + "[F", + actions.select_first_entry, + { desc = "Open the diff for the first file" }, + }, + { "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } }, + { + "n", + "gf", + actions.goto_file_edit, + { desc = "Open the file in the previous tabpage" }, + }, + { "n", "", actions.goto_file_split, { desc = "Open the file in a new split" } }, + { "n", "gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } }, + { "n", "f", actions.focus_files, { desc = "Bring focus to the file panel" } }, + { "n", "b", actions.toggle_files, { desc = "Toggle the file panel" } }, + { "n", "g", actions.cycle_layout, { desc = "Cycle available layouts" } }, + { "n", "g?", actions.help("file_history_panel"), { desc = "Open the help panel" } }, + }, + }, + } + end, +} diff --git a/nvim/dot-config/nvim/lua/plugins/gitlab.lua b/nvim/dot-config/nvim/lua/plugins/gitlab.lua new file mode 100644 index 0000000..0addc44 --- /dev/null +++ b/nvim/dot-config/nvim/lua/plugins/gitlab.lua @@ -0,0 +1,39 @@ +local window = require("symbols.window") +-- https://github.com/harrisoncramer/gitlab.nvim +--- @module "lazy" +--- @type LazySpec +return { + "harrisoncramer/gitlab.nvim", + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + }, + cond = function() + return vim.fn.executable("go") > 0 + end, + build = function() + require("gitlab.server").build(true) + end, -- Builds the Go binary + opts = { + discussion_tree = { + draft_mode = true, + }, + popup = { + border = window.border, + }, + discussion_signs = { + virtual_text = true, + }, + keymaps = { + discussion_tree = { + toggle_node = "za", + toggle_all_discussions = "zA", + }, + popup = { + perform_action = "w", + discard_changes = "", + }, + }, + }, +}