From 9a15e2a905d08077a0971f11e39d9fb513319be1 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 3 Sep 2025 14:53:17 +0300 Subject: [PATCH] add Gcm command --- lua/crentist/lazy/fugitive.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/crentist/lazy/fugitive.lua b/lua/crentist/lazy/fugitive.lua index e34bf22..aa1c884 100644 --- a/lua/crentist/lazy/fugitive.lua +++ b/lua/crentist/lazy/fugitive.lua @@ -3,6 +3,8 @@ return { config = function() vim.keymap.set('n', "gs", vim.cmd.Git) + vim.api.nvim_create_user_command('Gcm', function() vim.cmd.Git({ 'switch main' }) end, {}) + local Crentist_Fugitive = vim.api.nvim_create_augroup('Crentist_Fugitive', {}) local autocmd = vim.api.nvim_create_autocmd @@ -14,15 +16,15 @@ return { return end - local bufnr = vim.api.nvim_get_current_buf() - local opts = {buffer = bufnr, remap = false} + local SwitchToMainbufnr = vim.api.nvim_get_current_buf() + local opts = { buffer = bufnr, remap = false } vim.keymap.set('n', "p", function() vim.cmd.Git('push') end, opts) -- rebase always vim.keymap.set('n', "P", function() - vim.cmd.Git({'pull', '--rebase'}) + vim.cmd.Git({ 'pull', '--rebase' }) end, opts) -- NOTE: It allows me to easily set the branch i am pushing and any tracking