Skip to content

Commit

Permalink
feat: fugitive keymap updates
Browse files Browse the repository at this point in the history
chore

testing

noteuh:wq
  • Loading branch information
ThePrimeagen committed Dec 14, 2022
1 parent 50142c6 commit 4a96e64
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions after/plugin/fugitive.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);

local ThePrimeagen_Fugitive = vim.api.nvim_create_augroup("ThePrimeagen_Fugitive", {})

local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = ThePrimeagen_Fugitive,
pattern = "*",
callback = function()
print("help", vim.bo.ft)
if vim.bo.ft ~= "fugitive" then
return
end

local bufnr = vim.api.nvim_get_current_buf()
local opts = {buffer = bufnr, remap = false}
print("great success", vim.bo.ft, bufnr, vim.inspect(opts))
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,
})

1 comment on commit 4a96e64

@Ifechukwudaniel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice

Please sign in to comment.