lazy load gitsigns

This commit is contained in:
siduck76 2021-06-26 07:45:42 +05:30
parent 4c96c28c2d
commit 247e6e06c5
3 changed files with 41 additions and 29 deletions

View file

@ -28,7 +28,6 @@ require "highlights"
require "mappings" require "mappings"
require "telescope-nvim" require "telescope-nvim"
require "file-icons" require "file-icons"
require "gitsigns-nvim"
-- hide line numbers , statusline in specific buffers! -- hide line numbers , statusline in specific buffers!
vim.api.nvim_exec( vim.api.nvim_exec(

View file

@ -1,27 +1,33 @@
require("gitsigns").setup { local M = {}
signs = {
add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"}, M.config = function()
change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"}, require("gitsigns").setup {
delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"}, signs = {
topdelete = {hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr"}, add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"},
changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"} change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"},
}, delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"},
numhl = false, topdelete = {hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr"},
keymaps = { changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"}
-- Default keymap options },
noremap = true, numhl = false,
buffer = true, keymaps = {
["n ]c"] = {expr = true, '&diff ? \']c\' : \'<cmd>lua require"gitsigns".next_hunk()<CR>\''}, -- Default keymap options
["n [c"] = {expr = true, '&diff ? \'[c\' : \'<cmd>lua require"gitsigns".prev_hunk()<CR>\''}, noremap = true,
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', buffer = true,
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>', ["n ]c"] = {expr = true, '&diff ? \']c\' : \'<cmd>lua require"gitsigns".next_hunk()<CR>\''},
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', ["n [c"] = {expr = true, '&diff ? \'[c\' : \'<cmd>lua require"gitsigns".prev_hunk()<CR>\''},
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', ["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>' ["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
}, ["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
watch_index = { ["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
interval = 100 ["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>'
}, },
sign_priority = 5, watch_index = {
status_formatter = nil -- Use default interval = 100
} },
sign_priority = 5,
status_formatter = nil -- Use default
}
end
return M

View file

@ -45,7 +45,14 @@ return packer.startup(
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
use "kabouzeid/nvim-lspinstall" use "kabouzeid/nvim-lspinstall"
use "lewis6991/gitsigns.nvim" use {
"lewis6991/gitsigns.nvim",
event = "BufRead",
config = function()
require("gitsigns-nvim").config()
end
}
use "akinsho/nvim-bufferline.lua" use "akinsho/nvim-bufferline.lua"
use "glepnir/galaxyline.nvim" use "glepnir/galaxyline.nvim"