mirror of
https://github.com/cap153/nvim.git
synced 2026-04-20 12:15:34 +08:00
添加git signs插件
This commit is contained in:
parent
81b9d5964e
commit
c3a1663bdb
5 changed files with 60 additions and 17 deletions
37
lua/pack/configs/gitsigns.lua
Normal file
37
lua/pack/configs/gitsigns.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-- === git signs ===
|
||||
if vim.g.vscode then return end
|
||||
|
||||
local P = {
|
||||
name = "gitsigns.nvim",
|
||||
build_cmd = ":TSUpdate",
|
||||
}
|
||||
|
||||
-- 注册构建监听器
|
||||
PackUtils.setup_listener(P.name, P.build_cmd)
|
||||
|
||||
-- 懒加载触发器
|
||||
vim.api.nvim_create_autocmd({
|
||||
"UIEnter", -- vim.schedule(function()
|
||||
}, {
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
PackUtils.load(P, function()
|
||||
require('gitsigns').setup {
|
||||
on_attach = function()
|
||||
local gitsigns = require('gitsigns')
|
||||
local map = require("core.keymap")
|
||||
-- Navigation
|
||||
map:lua('t=', function()
|
||||
gitsigns.nav_hunk('next')
|
||||
end)
|
||||
map:lua('t-', function()
|
||||
gitsigns.nav_hunk('prev')
|
||||
end)
|
||||
-- show diff
|
||||
map:lua('<leader>hd', gitsigns.diffthis)
|
||||
end
|
||||
}
|
||||
end)
|
||||
end)
|
||||
end
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue