From 63feeb9f369fc6176e85c1c2d8fcc863caad1946 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 10 Feb 2026 12:32:48 +0100 Subject: start new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- .config/nvim/lua/plugins/git.lua | 116 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .config/nvim/lua/plugins/git.lua (limited to '.config/nvim/lua/plugins/git.lua') diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..2561ad9 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,116 @@ +return { + { + 'lewis6991/gitsigns.nvim', + lazy = false, + opts = { + debug_mode = false, + }, + keys = { + { + ']c', + function() + if vim.wo.diff then + vim.cmd.normal({ ']c', bang = true }) + else + require('gitsigns').nav_hunk('next') + end + end, + desc = 'Gitsigns: next hunk', + }, + { + '[c', + function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + require('gitsigns').nav_hunk('prev') + end + end, + desc = 'Gitsigns: prev hunk', + }, + { 'g', '', desc = 'git' }, + { 'g', 'Gitsigns', desc = 'Gitsigns: select action' }, + { 'gb', 'Gitsigns blame', desc = 'Gitsigns: blame' }, + { 'ga', 'Gitsigns stage_hunk', desc = 'Gitsigns: stage hunk' }, + { 'ga', ':Gitsigns stage_hunk', desc = 'Gitsigns: stage hunk', mode = 'x' }, + { 'gd', ':Gitsigns diffthis', desc = 'Gitsigns: diff' }, + { + ';c', + function() + require('gitsigns').setqflist('all', { open = false }) + require('fzf-lua').quickfix({ prompt = 'Git changesets' }) + end, + desc = 'Gitsigns: list hunks', + }, + }, + }, + + { + 'linrongbin16/gitlinker.nvim', + cmd = { 'GitLink' }, + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + message = true, + }, + keys = { + { + 'gl', + vim.cmd.GitLink, + desc = 'GitLinker: clipboard', + }, + }, + }, + + { + 'moyiz/git-dev.nvim', + lazy = true, + cmd = { 'GitDevOpen', 'GitDevCleanAll' }, + opts = { + read_only = false, + }, + }, + + { + 'isakbm/gitgraph.nvim', + dependencies = { 'sindrets/diffview.nvim' }, + opts = { + symbols = { + merge_commit = 'M', + commit = '∙', + }, + format = { + timestamp = '%d-%m-%Y %H:%M:%S %z', + fields = { 'hash', 'timestamp', 'author', 'branch_name', 'tag' }, + }, + }, + init = vim.schedule_wrap(function() + vim.api.nvim_set_hl(0, 'GitGraphBranch1', { fg = 'NvimLightGray1' }) + vim.api.nvim_set_hl(0, 'GitGraphBranch2', { fg = 'NvimLightMagenta' }) + vim.api.nvim_set_hl(0, 'GitGraphBranch3', { fg = 'NvimLightRed' }) + vim.api.nvim_set_hl(0, 'GitGraphBranch4', { fg = 'NvimDarkCyan' }) + vim.api.nvim_set_hl(0, 'GitGraphBranch5', { fg = 'NvimDarkYellow' }) + vim.api.nvim_set_hl(0, 'GitGraphHash', { fg = 'NvimLightMagenta' }) + vim.api.nvim_set_hl(0, 'GitGraphAuthor', { fg = 'NvimLightGray4', italic = true }) + vim.api.nvim_set_hl(0, 'GitGraphTimestamp', { fg = 'NvimLightCyan' }) + vim.api.nvim_set_hl(0, 'GitGraphBranchName', { fg = 'NvimLightYellow' }) + vim.api.nvim_set_hl(0, 'GitGraphBranchTag', { fg = 'NvimLightYellow' }) + vim.api.nvim_set_hl(0, 'GitGraphBranchMsg', { link = 'Normal' }) + -- vim.api.nvim_create_autocmd('FileType', { + -- pattern = { 'gitgraph' }, + -- callback = function() + -- vim.keymap.set('n', 'q', 'bdel!', { silent = true, buffer = 0 }) + -- end, + -- group = vim.api.nvim_create_augroup('GitGraph'), + -- }) + end), + keys = { + { + 'g-', + function() + require('gitgraph').draw({}, { all = true, max_count = 5000 }) + end, + desc = 'GitGraph: view log', + }, + }, + }, +} -- cgit 1.4.1