81 lines
2.1 KiB
Lua
81 lines
2.1 KiB
Lua
require('my/plugins')
|
|
|
|
local map = require('my.functions').map
|
|
|
|
require('Comment').setup({
|
|
toggler = {
|
|
line = '<Leader>cc',
|
|
block = '<Leader>CC'
|
|
},
|
|
opleader = {
|
|
line = '<Leader>c',
|
|
block = '<Leader>C'
|
|
},
|
|
extra = {
|
|
above = '<Leader>cO',
|
|
below = '<Leader>co',
|
|
eol = '<Leader>cA',
|
|
},
|
|
pre_hook = function(ctx)
|
|
local comment_utils = require "Comment.utils"
|
|
local context_utils = require('ts_context_commentstring.utils')
|
|
local context_internal = require('ts_context_commentstring.internal')
|
|
|
|
local location = nil
|
|
if ctx.ctype == comment_utils.ctype.block then
|
|
location = context_utils.get_cursor_location()
|
|
elseif ctx.cmotion == comment_utils.cmotion.v or
|
|
ctx.cmotion == comment_utils.cmotion.V then
|
|
location = context_utils.get_visual_start_location()
|
|
end
|
|
|
|
return context_internal.calculate_commentstring {
|
|
key = ctx.ctype == comment_utils.ctype.line and "__default" or
|
|
"__multiline",
|
|
location = location,
|
|
}
|
|
end
|
|
})
|
|
|
|
local neogit = require('neogit')
|
|
neogit.setup {
|
|
disable_commit_confirmation = true,
|
|
kind = 'tab',
|
|
integrations = {
|
|
diffview = true
|
|
}
|
|
}
|
|
map('n', '<Leader>gg', neogit.open, 'Open Neogit')
|
|
|
|
-- start git commits in insert mode
|
|
vim.api.nvim_create_augroup('config_coding', { clear = true })
|
|
vim.api.nvim_create_autocmd(
|
|
{ 'FileType' },
|
|
{
|
|
group = 'config_coding',
|
|
pattern = { 'gitcommit', 'gitrebase' },
|
|
command = [[startinsert | 1]]
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd(
|
|
{ 'FileType' },
|
|
{
|
|
group = 'config_coding',
|
|
pattern = { 'Neogit*' },
|
|
command = [[set nolist]]
|
|
})
|
|
|
|
|
|
require("luasnip.loaders.from_lua").load({
|
|
paths = vim.fn.stdpath('config') .. '/snippets'
|
|
})
|
|
|
|
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
|
|
})
|