Skip to content

Commit a6be88a

Browse files
committed
Make git related plugins in nvim to be VeryLazy
1 parent 5ea3061 commit a6be88a

File tree

2 files changed

+63
-62
lines changed

2 files changed

+63
-62
lines changed
+45-45
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
-- git hunk interaction
22
return {
3-
"lewis6991/gitsigns.nvim",
4-
event = { "BufReadPre", "BufNewFile" },
5-
opts = {
6-
on_attach = function(bufnr)
7-
local gs = package.loaded.gitsigns
8-
9-
local function map(mode, l, r, desc)
10-
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
11-
end
12-
13-
-- Navigation
14-
map("n", "]h", gs.next_hunk, "Next Hunk")
15-
map("n", "[h", gs.prev_hunk, "Prev Hunk")
16-
17-
-- Actions
18-
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
19-
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
20-
map("v", "<leader>hs", function()
21-
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
22-
end, "Stage hunk")
23-
map("v", "<leader>hr", function()
24-
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
25-
end, "Reset hunk")
26-
27-
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
28-
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
29-
30-
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
31-
32-
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
33-
34-
map("n", "<leader>hb", function()
35-
gs.blame_line({ full = true })
36-
end, "Blame line")
37-
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
38-
39-
map("n", "<leader>hd", gs.diffthis, "Diff this")
40-
map("n", "<leader>hD", function()
41-
gs.diffthis("~")
42-
end, "Diff this ~")
43-
44-
-- Text object
45-
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
46-
end,
47-
},
3+
"lewis6991/gitsigns.nvim",
4+
event = "VeryLazy",
5+
opts = {
6+
on_attach = function(bufnr)
7+
local gs = package.loaded.gitsigns
8+
9+
local function map(mode, l, r, desc)
10+
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
11+
end
12+
13+
-- Navigation
14+
map("n", "]h", gs.next_hunk, "Next Hunk")
15+
map("n", "[h", gs.prev_hunk, "Prev Hunk")
16+
17+
-- Actions
18+
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
19+
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
20+
map("v", "<leader>hs", function()
21+
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
22+
end, "Stage hunk")
23+
map("v", "<leader>hr", function()
24+
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
25+
end, "Reset hunk")
26+
27+
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
28+
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
29+
30+
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
31+
32+
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
33+
34+
map("n", "<leader>hb", function()
35+
gs.blame_line({ full = true })
36+
end, "Blame line")
37+
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
38+
39+
map("n", "<leader>hd", gs.diffthis, "Diff this")
40+
map("n", "<leader>hD", function()
41+
gs.diffthis("~")
42+
end, "Diff this ~")
43+
44+
-- Text object
45+
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
46+
end,
47+
},
4848
}
+18-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
-- interacts with lazygit for git integration
22
return {
3-
"kdheepak/lazygit.nvim",
4-
cmd = {
5-
"LazyGit",
6-
"LazyGitConfig",
7-
"LazyGitCurrentFile",
8-
"LazyGitFilter",
9-
"LazyGitFilterCurrentFile",
10-
},
11-
-- optional for floating window border decoration
12-
dependencies = {
13-
"nvim-lua/plenary.nvim",
14-
},
15-
-- setting the keybinding for LazyGit with 'keys' is recommended in
16-
-- order to load the plugin when the command is run for the first time
17-
keys = {
18-
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "Open lazy git" },
19-
},
3+
"kdheepak/lazygit.nvim",
4+
event = "VeryLazy",
5+
cmd = {
6+
"LazyGit",
7+
"LazyGitConfig",
8+
"LazyGitCurrentFile",
9+
"LazyGitFilter",
10+
"LazyGitFilterCurrentFile",
11+
},
12+
-- optional for floating window border decoration
13+
dependencies = {
14+
"nvim-lua/plenary.nvim",
15+
},
16+
-- setting the keybinding for LazyGit with 'keys' is recommended in
17+
-- order to load the plugin when the command is run for the first time
18+
keys = {
19+
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "Open lazy git" },
20+
},
2021
}

0 commit comments

Comments
 (0)