init.lua/after/plugin/fugitive.lua

28 lines
702 B
Lua
Raw Normal View History

vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Git status" })
2023-12-24 12:06:23 +01:00
local Crony_Fugitive = vim.api.nvim_create_augroup("Crony_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = Crony_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
2023-12-24 12:06:23 +01:00
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)
2023-12-24 12:06:23 +01:00
-- rebase always
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({ "pull", "--rebase" })
end, opts)
2023-12-24 12:06:23 +01:00
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts)
end,
2023-12-24 12:06:23 +01:00
})