dotfiles/.config/nvim/lua/my/plugins/git.lua
tea 7689f8a270
nvim: more stuff ported from old config
- git
- more keybindings
- some fixes
2024-09-03 11:38:45 +02:00

59 lines
2.5 KiB
Lua

local map = require('my.functions').map
return {
{ 'https://github.com/tpope/vim-fugitive',
version = '*',
keys = {
{ '<leader>gcc', '<cmd>:Git commit<cr>', desc = 'commit' },
{ '<leader>gca', '<cmd>:Git commit --amend<cr>', desc = 'amend' },
{ '<leader>gP', '<cmd>:Git push<cr>', desc = 'push' },
{ '<leader>gpo', '<cmd>:Git pull origin<cr>', desc = 'origin' },
{ '<leader>gpu', '<cmd>:Git pull upstream<cr>', desc = 'upstream' },
{ '<leader>gau', '<cmd>:Git add --update --patch<cr>', desc = '--update --patch' },
{ '<leader>ga%', '<cmd>:Git add %<cr>', desc = 'this file' },
{ '<leader>gl', '<cmd>:Git log --decorate<cr>', desc = 'log' },
{ '<leader>gs', '<cmd>:Git status<cr>', desc = 'status' },
}
},
{ 'https://github.com/lewis6991/gitsigns.nvim',
version = '*',
opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
map('n', '<Leader>gb',
function() gs.blame_line({ full = true }) end,
'show blame for current line', bufnr)
end,
},
},
{ 'https://github.com/linrongbin16/gitlinker.nvim',
dependencies = { 'plenary.nvim' },
version = '*',
opts = {
router = {
browse = {
["^schlomp%.space"] = "https://schlomp.space/"
.. "{_A.ORG}/"
.. "{_A.REPO}/src/commit/"
.. "{_A.REV}/"
.. "{_A.FILE}?display=source" -- '?display=source'
.. "#L{_A.LSTART}"
.. "{(_A.LEND > _A.LSTART and ('-L' .. _A.LEND) or '')}",
['^git%.gentoo%.org'] = "https://gitweb.gentoo.org/?p="
.. "{string.len(_A.ORG) > 0 and (_A.ORG .. '/') or ''}"
.. "{_A.REPO .. '.git'};a=blob;"
.. "f={_A.FILE};"
.. "hb={_A.REV}"
.. "#l{_A.LSTART}",
['^anongit%.gentoo%.org'] = "https://gitweb.gentoo.org/?p="
.. "{string.len(_A.ORG) > 0 and (_A.ORG .. '/') or ''}"
.. "{_A.REPO .. '.git'};a=blob;"
.. "f={_A.FILE};"
.. "hb={_A.REV}"
.. "#l{_A.LSTART}",
}
}
}
}
}