neovim: lazy-load some plugins

Also rebind mappings for GitSigns
This commit is contained in:
FollieHiyuki 2021-07-09 01:26:52 +03:00
parent e1b2a23507
commit d1be74ee0b
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
3 changed files with 9 additions and 7 deletions

View File

@ -94,9 +94,9 @@ wk.register({
g = { g = {
name = 'Git', name = 'Git',
b = 'Blame current line', b = 'Blame current line',
i = 'Preview hunk', j = 'Next hunk',
n = 'Next hunk', k = 'Previous hunk',
p = 'Previous hunk', p = 'Preview hunk',
r = 'Reset hunk', r = 'Reset hunk',
R = 'Reset all hunks in buffer', R = 'Reset all hunks in buffer',
s = 'Stage hunk', s = 'Stage hunk',

View File

@ -12,8 +12,8 @@ return require('gitsigns').setup {
noremap = true, noremap = true,
buffer = true, buffer = true,
['n <leader>gn'] = {expr = true, '&diff ? \'<leader>gn\' : \'<cmd>lua require"gitsigns.actions".next_hunk()<CR>\''}, ['n <leader>gj'] = {expr = true, '&diff ? \'<leader>gj\' : \'<cmd>lua require"gitsigns.actions".next_hunk()<CR>\''},
['n <leader>gp'] = {expr = true, '&diff ? \'<leader>gp\' : \'<cmd>lua require"gitsigns.actions".prev_hunk()<CR>\''}, ['n <leader>gk'] = {expr = true, '&diff ? \'<leader>gk\' : \'<cmd>lua require"gitsigns.actions".prev_hunk()<CR>\''},
['n <leader>gs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', ['n <leader>gs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
['v <leader>gs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>', ['v <leader>gs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
@ -21,7 +21,7 @@ return require('gitsigns').setup {
['n <leader>gr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', ['n <leader>gr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
['v <leader>gr'] = '<cmd>lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>', ['v <leader>gr'] = '<cmd>lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
['n <leader>gR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>', ['n <leader>gR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
['n <leader>gi'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', ['n <leader>gp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
['n <leader>gb'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>' ['n <leader>gb'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>'
}, },
watch_index = { watch_index = {

View File

@ -60,6 +60,7 @@ return packer.startup(
use { use {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
requires = 'nvim-lua/plenary.nvim', requires = 'nvim-lua/plenary.nvim',
event = {'BufRead', 'BufNewFile'},
config = function() config = function()
require('modules.gitgutter') require('modules.gitgutter')
end end
@ -76,6 +77,7 @@ return packer.startup(
} }
use { use {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
event = 'BufRead',
config = function() config = function()
require('modules.blankline') require('modules.blankline')
end end
@ -112,7 +114,7 @@ return packer.startup(
-- Editing -- Editing
use { use {
'terrortylor/nvim-comment', 'terrortylor/nvim-comment',
cmd = 'CommentToggle', after = 'nvim-treesitter',
config = function() config = function()
require('nvim_comment').setup() require('nvim_comment').setup()
end end