diff --git a/config/neovim/after/plugin/fugitive.lua b/config/neovim/after/plugin/fugitive.lua new file mode 100644 index 0000000..311cfc8 --- /dev/null +++ b/config/neovim/after/plugin/fugitive.lua @@ -0,0 +1,22 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) + +vim.api.nvim_create_autocmd("BufWinEnter", { + 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", "p", function() + vim.cmd.Git('push') + end, opts) + + vim.keymap.set("n", "P", function() + vim.cmd.Git({'pull', '--rebase'}) + end, opts) + end, +})