Skip to content

Commit 4a96e64

Browse files
committed
feat: fugitive keymap updates
chore testing noteuh:wq
1 parent 50142c6 commit 4a96e64

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

after/plugin/fugitive.lua

+29
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
22

3+
local ThePrimeagen_Fugitive = vim.api.nvim_create_augroup("ThePrimeagen_Fugitive", {})
4+
5+
local autocmd = vim.api.nvim_create_autocmd
6+
autocmd("BufWinEnter", {
7+
group = ThePrimeagen_Fugitive,
8+
pattern = "*",
9+
callback = function()
10+
print("help", vim.bo.ft)
11+
if vim.bo.ft ~= "fugitive" then
12+
return
13+
end
14+
15+
local bufnr = vim.api.nvim_get_current_buf()
16+
local opts = {buffer = bufnr, remap = false}
17+
print("great success", vim.bo.ft, bufnr, vim.inspect(opts))
18+
vim.keymap.set("n", "<leader>p", function()
19+
vim.cmd [[ Git push ]]
20+
end, opts)
21+
22+
-- rebase always
23+
vim.keymap.set("n", "<leader>P", function()
24+
vim.cmd [[ Git pull --rebase ]]
25+
end, opts)
26+
27+
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
28+
-- needed if i did not set the branch up correctly
29+
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
30+
end,
31+
})

0 commit comments

Comments
 (0)