base setup and fugitive config
This commit is contained in:
parent
98ad2ee32a
commit
fa0f5828c3
8 changed files with 42 additions and 101 deletions
34
lua/lornest/plugins/fugitive.lua
Normal file
34
lua/lornest/plugins/fugitive.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
'tpope/vim-fugitive',
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
|
||||
local Lornest_Fugitive = vim.api.nvim_create_augroup("Lornest_Fugitive", {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd("BufWinEnter", {
|
||||
group = Lornest_Fugitive,
|
||||
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", "<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,
|
||||
})
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue