refactor: add diffview.nvim and move all git related plugins to git.lua

This commit is contained in:
Seymur Bagirov 2024-09-15 19:35:11 +04:00
parent 98798dd577
commit 0f9dc8f311
4 changed files with 51 additions and 42 deletions

View File

@ -13,6 +13,7 @@
"copilot.vim": { "branch": "release", "commit": "a9fa7946d7307ceb138bfe2706ba75febf6450da" },
"cord.nvim": { "branch": "master", "commit": "40e0a17fc023011b9436d0b3583f874818f3ed3b" },
"csharpls-extended-lsp.nvim": { "branch": "master", "commit": "5a474b06743bb20a90191994457f5e62f444976b" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" },
"go.nvim": { "branch": "master", "commit": "e66c3240d26936428cd0f320dc5ffa1eb01538b8" },

View File

@ -1,34 +0,0 @@
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local TheMystery_Fugitive = vim.api.nvim_create_augroup("TheMystery_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = TheMystery_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git('push')
end, opts)
-- rebase always
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({ 'pull', '--rebase' })
end, opts)
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
-- needed if i did not set the branch up correctly
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
end,
})
end
}

View File

@ -0,0 +1,50 @@
return {
{
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local TheMystery_Fugitive = vim.api.nvim_create_augroup("TheMystery_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = TheMystery_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git('push')
end, opts)
-- rebase always
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({ 'pull', '--rebase' })
end, opts)
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
-- needed if i did not set the branch up correctly
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
end,
})
end
},
{
"lewis6991/gitsigns.nvim",
config = function()
-- TODOS: Add keybindings
require("gitsigns").setup()
end
},
{
"sindrets/diffview.nvim",
dependencies = {
"kyazdani42/nvim-web-devicons"
},
}
}

View File

@ -1,8 +0,0 @@
return {
"lewis6991/gitsigns.nvim",
config = function()
-- TODOS: Add keybindings
require("gitsigns").setup()
end
}