update git setup

This commit is contained in:
Alexander Navarro 2023-10-25 21:43:50 -03:00
parent 550061ede5
commit 33cce48101
4 changed files with 89 additions and 40 deletions

View file

@ -9,12 +9,15 @@
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"comment-box.nvim": { "branch": "main", "commit": "dd1a48f8d06102e9b87ae1e0069bc365c006979b" },
"conform.nvim": { "branch": "master", "commit": "e4ecb6e8ed3163c86d7e647f1dc3d94de77ca687" },
"diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" },
"dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"fzf-lua": { "branch": "main", "commit": "6589bdd872385d120a1eb3cb85e5d15d37621c1d" },
"gitsigns.nvim": { "branch": "main", "commit": "5a9a6ac29a7805c4783cda21b80a1e361964b3f2" },
"harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" },
"indent-blankline.nvim": { "branch": "master", "commit": "046e2cf04e08ece927bacbfb87c5b35c0b636546" },
"lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" },
"lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" },
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "09be3766669bfbabbe2863c624749d8da392c916" },
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
@ -25,6 +28,7 @@
"mini.pairs": { "branch": "main", "commit": "6f6bd7ed5757b40bc29c73dac0d743e4e6978124" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neodev.nvim": { "branch": "main", "commit": "d617d9eb27e73e701e446874c6ea2cb528719260" },
"neogit": { "branch": "master", "commit": "01dc0a7e237a4d6d053cea2503f5dd1a81c1e310" },
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
@ -51,6 +55,5 @@
"ts-node-action": { "branch": "master", "commit": "f266409809555d7604b1ba894ffad8958670d04f" },
"vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" },
"vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }
}

View file

@ -0,0 +1,85 @@
return {
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, "<leader>g" .. l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "j", gs.next_hunk, "Next Hunk")
map("n", "k", gs.prev_hunk, "Prev Hunk")
map({ "n", "v" }, "s", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
map({ "n", "v" }, "r", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "R", gs.reset_buffer, "Reset Buffer")
map("n", "p", gs.preview_hunk, "Preview Hunk")
map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "d", gs.diffthis, "Diff This")
map("n", "D", function() gs.diffthis("~") end, "Diff This ~")
end,
},
},
-- Testing main Git plugin
{
"tpope/vim-fugitive",
event = "VeryLazy",
keys = {
{ "<leader>gG", ":Git<CR>", { desc = "Fugitive" } },
},
},
{
"kdheepak/lazygit.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>gL", ":LazyGit<CR>", { desc = "Lazygit" } },
},
},
{
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"nvim-telescope/telescope.nvim", -- optional
"sindrets/diffview.nvim", -- optional
"ibhagwan/fzf-lua", -- optional
},
config = true,
opts = {
disable_insert_on_commit = "auto",
kind = "replace",
disable_line_numbers = false,
commit_editor = {
kind = "replace",
},
},
keys = {
{
"<leader>gg",
function()
require("neogit").open()
end,
{ desc = "Neogit" },
},
},
},
}

View file

@ -1,35 +0,0 @@
-- Adds git releated signs to the gutter, as well as utilities for managing changes
return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, "<leader>g" .. l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "j", gs.next_hunk, "Next Hunk")
map("n", "k", gs.prev_hunk, "Prev Hunk")
map({ "n", "v" }, "s", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
map({ "n", "v" }, "r", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
map("n", "u", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "R", gs.reset_buffer, "Reset Buffer")
map("n", "p", gs.preview_hunk, "Preview Hunk")
map("n", "l", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "d", gs.diffthis, "Diff This")
map("n", "D", function() gs.diffthis("~") end, "Diff This ~")
end,
},
}

View file

@ -1,10 +1,6 @@
return {
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
"tpope/vim-fugitive",
"tpope/vim-rhubarb",
-- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth",