summary refs log tree commit diff
path: root/.vim/lua/internal/plugins/git.lua
diff options
context:
space:
mode:
Diffstat (limited to '.vim/lua/internal/plugins/git.lua')
-rw-r--r--.vim/lua/internal/plugins/git.lua108
1 files changed, 108 insertions, 0 deletions
diff --git a/.vim/lua/internal/plugins/git.lua b/.vim/lua/internal/plugins/git.lua
new file mode 100644
index 0000000..d907161
--- /dev/null
+++ b/.vim/lua/internal/plugins/git.lua
@@ -0,0 +1,108 @@
+return {
+  {
+    'lewis6991/gitsigns.nvim',
+    lazy = false,
+    opts = {
+      signs = {
+        change = { text = '▋' },
+        add = { text = '▋' },
+      },
+    },
+    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',
+      },
+      { '<leader>gb', '<cmd>Gitsigns blame<cr>', desc = 'Gitsigns: blame' },
+      { '<leader>gs', '<cmd>Gitsigns<cr>', desc = 'Gitsigns: select action' },
+      {
+        ';c',
+        function()
+          require('gitsigns').setqflist('all', { open = false })
+          require('telescope.builtin').quickfix({ prompt_title = 'Git changesets' })
+        end,
+        desc = 'Telescope: list hunks via gitsigns',
+      },
+    },
+  },
+
+  {
+    'linrongbin16/gitlinker.nvim',
+    cmd = { 'GitLink' },
+    dependencies = { 'nvim-lua/plenary.nvim' },
+    opts = {
+      message = true,
+    },
+    keys = {
+      {
+        '<leader>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' })
+    end),
+    keys = {
+      {
+        'g-',
+        function()
+          require('gitgraph').draw({}, { all = true, max_count = 5000 })
+        end,
+        desc = 'git graph',
+      },
+    },
+  },
+}