diff --git a/init.lua b/init.lua index bcdf14b..8433023 100644 --- a/init.lua +++ b/init.lua @@ -28,7 +28,6 @@ require "highlights" require "mappings" require "telescope-nvim" require "file-icons" -require "gitsigns-nvim" -- hide line numbers , statusline in specific buffers! vim.api.nvim_exec( diff --git a/lua/gitsigns-nvim.lua b/lua/gitsigns-nvim.lua index 1fa4325..85973e2 100644 --- a/lua/gitsigns-nvim.lua +++ b/lua/gitsigns-nvim.lua @@ -1,27 +1,33 @@ -require("gitsigns").setup { - signs = { - add = {hl = "DiffAdd", text = "▌", numhl = "GitSignsAddNr"}, - change = {hl = "DiffChange", text = "▌", numhl = "GitSignsChangeNr"}, - delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"}, - topdelete = {hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr"}, - changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"} - }, - numhl = false, - keymaps = { - -- Default keymap options - noremap = true, - buffer = true, - ["n ]c"] = {expr = true, '&diff ? \']c\' : \'lua require"gitsigns".next_hunk()\''}, - ["n [c"] = {expr = true, '&diff ? \'[c\' : \'lua require"gitsigns".prev_hunk()\''}, - ["n hs"] = 'lua require"gitsigns".stage_hunk()', - ["n hu"] = 'lua require"gitsigns".undo_stage_hunk()', - ["n hr"] = 'lua require"gitsigns".reset_hunk()', - ["n hp"] = 'lua require"gitsigns".preview_hunk()', - ["n hb"] = 'lua require"gitsigns".blame_line()' - }, - watch_index = { - interval = 100 - }, - sign_priority = 5, - status_formatter = nil -- Use default -} +local M = {} + +M.config = function() + require("gitsigns").setup { + signs = { + add = {hl = "DiffAdd", text = "▌", numhl = "GitSignsAddNr"}, + change = {hl = "DiffChange", text = "▌", numhl = "GitSignsChangeNr"}, + delete = {hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr"}, + topdelete = {hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr"}, + changedelete = {hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr"} + }, + numhl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + ["n ]c"] = {expr = true, '&diff ? \']c\' : \'lua require"gitsigns".next_hunk()\''}, + ["n [c"] = {expr = true, '&diff ? \'[c\' : \'lua require"gitsigns".prev_hunk()\''}, + ["n hs"] = 'lua require"gitsigns".stage_hunk()', + ["n hu"] = 'lua require"gitsigns".undo_stage_hunk()', + ["n hr"] = 'lua require"gitsigns".reset_hunk()', + ["n hp"] = 'lua require"gitsigns".preview_hunk()', + ["n hb"] = 'lua require"gitsigns".blame_line()' + }, + watch_index = { + interval = 100 + }, + sign_priority = 5, + status_formatter = nil -- Use default + } +end + +return M diff --git a/lua/pluginList.lua b/lua/pluginList.lua index 39cdde1..8ece11f 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -45,7 +45,14 @@ return packer.startup( use "nvim-lua/plenary.nvim" 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 "glepnir/galaxyline.nvim"