59 lines
1.7 KiB
Lua
59 lines
1.7 KiB
Lua
local map = require('my.functions').map
|
|
|
|
local neogit = require('neogit')
|
|
neogit.setup {
|
|
disable_commit_confirmation = true,
|
|
kind = 'tab',
|
|
integrations = {
|
|
diffview = true
|
|
},
|
|
disable_insert_on_commit = false
|
|
}
|
|
map('n', '<Leader>gg', neogit.open, 'Open Neogit')
|
|
|
|
-- start git commits in insert mode
|
|
local gitgroup = vim.api.nvim_create_augroup('config_git', { clear = true })
|
|
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|
group = gitgroup,
|
|
pattern = { 'gitcommit', 'gitrebase' },
|
|
command = [[startinsert | 1]]
|
|
})
|
|
|
|
-- split Neogit commit messages vertically if possible
|
|
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|
group = gitgroup,
|
|
pattern = { 'NeogitCommitMessage' },
|
|
callback = require('autosplit')
|
|
})
|
|
|
|
-- don't show dots for spaces in Neogit buffers
|
|
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
|
group = gitgroup,
|
|
pattern = { 'Neogit*' },
|
|
command = [[set nolist]]
|
|
})
|
|
|
|
require('gitsigns').setup({
|
|
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
|
|
})
|
|
|
|
require('gitlinker').setup({
|
|
callbacks = {
|
|
['schlomp.space'] = require('gitlinker.hosts').get_gitea_type_url,
|
|
['git.gentoo.org'] = function(url_data)
|
|
url_data.host = 'gitweb.gentoo.org'
|
|
return require('gitlinker.hosts').get_cgit_type_url(url_data)
|
|
end,
|
|
['anongit.gentoo.org'] = function(url_data)
|
|
url_data.host = 'gitweb.gentoo.org'
|
|
url_data.repo = url_data.repo:gsub('^git/', '', 1)
|
|
return require('gitlinker.hosts').get_cgit_type_url(url_data)
|
|
end,
|
|
}
|
|
})
|