update: nvim: add gitsigns
This commit is contained in:
parent
5b5e9723eb
commit
47cf7360d7
1 changed files with 35 additions and 4 deletions
|
@ -15,18 +15,18 @@ vim.opt.rtp:prepend(lazypath)
|
|||
|
||||
-- Installing plugins
|
||||
require('lazy').setup({
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
{
|
||||
{ "catppuccin/nvim", name = "catppuccin" }, -- Color scheme
|
||||
{ -- comment
|
||||
'numToStr/Comment.nvim',
|
||||
config = function ()
|
||||
require('Comment').setup()
|
||||
end,
|
||||
},
|
||||
-- lualine(statusline)
|
||||
{
|
||||
{ -- lualine(statusline)
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true }
|
||||
},
|
||||
{ 'lewis6991/gitsigns.nvim', },
|
||||
'neovim/nvim-lspconfig',
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
|
@ -125,6 +125,37 @@ end
|
|||
local ft = require('Comment.ft')
|
||||
ft.set('satysfi', '%%s')
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- gitsigns
|
||||
require('gitsigns').setup {
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
---custom mapping func
|
||||
---@param mode string|string[]
|
||||
---@param l string
|
||||
---@param r any
|
||||
---@param opts table?
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true})
|
||||
end
|
||||
}
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- lualine
|
||||
require('lualine_setup')
|
||||
|
|
Loading…
Reference in a new issue