dotfiles/.config/nvim/lua/my/coding.lua

72 lines
1.9 KiB
Lua
Raw Normal View History

require('my/plugins')
require('my/keymaps')
2022-08-13 17:04:51 +02:00
require('my/tools')
2022-08-16 02:49:33 +02:00
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.blockwise 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.utils.get_visual_start_location()
end
return context_internal.calculate_commentstring {
key = ctx.ctype == comment_utils.ctype.linewise and "__default" or "__multiline",
location = location,
}
end
})
map('i', '<M-c>', '<Leader>cA')
local neogit = require('neogit')
neogit.setup {
disable_commit_confirmation = true,
kind = 'tab',
integrations = {
diffview = true
}
}
map('n', '<Leader>g', neogit.open)
-- start git commits in insert mode
2022-08-10 17:52:25 +02:00
vim.api.nvim_create_augroup('config_coding', { clear = true })
vim.api.nvim_create_autocmd(
{ 'FileType' },
{
group = 'config_coding',
pattern = { 'gitcommit', 'gitrebase' },
command = [[startinsert | 1]]
2022-08-10 17:52:25 +02:00
})
2022-08-09 00:19:29 +02:00
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'
})