mirror of
https://github.com/cap153/nvim.git
synced 2026-05-10 00:26:23 +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
|
||||||
|
})
|
||||||
|
|
@ -23,7 +23,7 @@ end, { desc = "Lazy load and open Peek" })
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("PeekClose", function()
|
vim.api.nvim_create_user_command("PeekClose", function()
|
||||||
-- 如果插件没加载,Close 命令通常不需要做任何事,或者也触发加载
|
-- 如果插件没加载,Close 命令通常不需要做任何事,或者也触发加载
|
||||||
if PackUtils.is_initialized[P.name] then
|
if PackUtils.plugin_loaded[P.name] then
|
||||||
require("peek").close()
|
require("peek").close()
|
||||||
end
|
end
|
||||||
end, { desc = "Close Peek" })
|
end, { desc = "Close Peek" })
|
||||||
|
|
|
||||||
|
|
@ -19,29 +19,31 @@ local specs = {
|
||||||
-- treesitter.lua 需要安装tree-sitter-cli工具包
|
-- treesitter.lua 需要安装tree-sitter-cli工具包
|
||||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||||
-- indentblankline.lua 彩虹缩进
|
-- indentblankline.lua 彩虹缩进
|
||||||
"https://github.com/lukas-reineke/indent-blankline.nvim",
|
'https://github.com/lukas-reineke/indent-blankline.nvim',
|
||||||
|
-- gitsigns.lua 突出增、删、改过的行
|
||||||
|
'https://github.com/lewis6991/gitsigns.nvim',
|
||||||
-- ufo.lua 折叠插件
|
-- ufo.lua 折叠插件
|
||||||
"https://github.com/kevinhwang91/nvim-ufo",
|
'https://github.com/kevinhwang91/nvim-ufo',
|
||||||
"https://github.com/kevinhwang91/promise-async",
|
'https://github.com/kevinhwang91/promise-async',
|
||||||
-- stickscroll.lua 代码函数名称浏览时固定
|
-- stickscroll.lua 代码函数名称浏览时固定
|
||||||
"https://github.com/nvim-treesitter/nvim-treesitter-context",
|
'https://github.com/nvim-treesitter/nvim-treesitter-context',
|
||||||
-- bufferline.lua 顶部状态栏
|
-- bufferline.lua 顶部状态栏
|
||||||
'https://github.com/akinsho/bufferline.nvim',
|
'https://github.com/akinsho/bufferline.nvim',
|
||||||
-- lualine.lua 底部状态栏
|
-- lualine.lua 底部状态栏
|
||||||
"https://github.com/nvim-lualine/lualine.nvim",
|
'https://github.com/nvim-lualine/lualine.nvim',
|
||||||
-- outline.lua 大纲、函数变量结构
|
-- outline.lua 大纲、函数变量结构
|
||||||
"https://github.com/hedyhli/outline.nvim",
|
'https://github.com/hedyhli/outline.nvim',
|
||||||
-- noice.lua 取代消息、命令行和弹出菜单的 UI
|
-- noice.lua 取代消息、命令行和弹出菜单的 UI
|
||||||
"https://github.com/folke/noice.nvim",
|
'https://github.com/folke/noice.nvim',
|
||||||
"https://github.com/MunifTanjim/nui.nvim",
|
'https://github.com/MunifTanjim/nui.nvim',
|
||||||
-- snacks.lua 图片预览、lazygit、lsp_references模糊查找
|
-- snacks.lua 图片预览、lazygit、lsp_references模糊查找
|
||||||
"https://github.com/folke/snacks.nvim",
|
'https://github.com/folke/snacks.nvim',
|
||||||
-- mini.lua 各种对字符的surround包裹{} [] ''
|
-- mini.lua 各种对字符的surround包裹{} [] ''
|
||||||
"https://github.com/echasnovski/mini.nvim",
|
'https://github.com/echasnovski/mini.nvim',
|
||||||
-- autopairs.lua 对字符自动补全另一半
|
-- autopairs.lua 对字符自动补全另一半
|
||||||
"https://github.com/windwp/nvim-autopairs",
|
'https://github.com/windwp/nvim-autopairs',
|
||||||
-- tv.lua 模糊查找television
|
-- tv.lua 模糊查找television
|
||||||
"https://github.com/alexpasmantier/tv.nvim",
|
'https://github.com/alexpasmantier/tv.nvim',
|
||||||
-- coderunner.lua 运行代码
|
-- coderunner.lua 运行代码
|
||||||
'https://github.com/CRAG666/code_runner.nvim',
|
'https://github.com/CRAG666/code_runner.nvim',
|
||||||
-- peek.lua 预览markdown
|
-- peek.lua 预览markdown
|
||||||
|
|
@ -49,11 +51,11 @@ local specs = {
|
||||||
-- yazi.lua 文件管理器
|
-- yazi.lua 文件管理器
|
||||||
'https://github.com/mikavilpas/yazi.nvim',
|
'https://github.com/mikavilpas/yazi.nvim',
|
||||||
-- translate.lua 快捷键翻译
|
-- translate.lua 快捷键翻译
|
||||||
"https://github.com/uga-rosa/translate.nvim",
|
'https://github.com/uga-rosa/translate.nvim',
|
||||||
-- sudo权限保存文件
|
-- sudo权限保存文件
|
||||||
"https://github.com/lambdalisue/vim-suda",
|
'https://github.com/lambdalisue/vim-suda',
|
||||||
-- 查看可用键位
|
-- 查看可用键位
|
||||||
"https://github.com/folke/which-key.nvim",
|
'https://github.com/folke/which-key.nvim',
|
||||||
}
|
}
|
||||||
-- 禁用插件:不会加载,不会下载(如果是新添加的),已在硬盘上不会被删除
|
-- 禁用插件:不会加载,不会下载(如果是新添加的),已在硬盘上不会被删除
|
||||||
local disabled = {
|
local disabled = {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@
|
||||||
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
||||||
"src": "https://github.com/rafamadriz/friendly-snippets"
|
"src": "https://github.com/rafamadriz/friendly-snippets"
|
||||||
},
|
},
|
||||||
|
"gitsigns.nvim": {
|
||||||
|
"rev": "8d82c240f190fc33723d48c308ccc1ed8baad69d",
|
||||||
|
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
||||||
|
},
|
||||||
"indent-blankline.nvim": {
|
"indent-blankline.nvim": {
|
||||||
"rev": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03",
|
"rev": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03",
|
||||||
"src": "https://github.com/lukas-reineke/indent-blankline.nvim"
|
"src": "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"github": {
|
"github": {
|
||||||
"prefix": "github",
|
"prefix": "github",
|
||||||
"body": [
|
"body": [
|
||||||
"\"https:\/\/github.com\/${0}\","
|
"'https:\/\/github.com\/${0}',"
|
||||||
],
|
],
|
||||||
"description": "Github url"
|
"description": "Github url"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue