Add fugitive
This commit is contained in:
parent
bc23503b46
commit
7b66c99953
|
@ -1,6 +1,43 @@
|
|||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup({
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
--
|
||||
{
|
||||
'tpope/vim-fugitive',
|
||||
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
|
||||
|
||||
local mimivalsi_fugitive = vim.api.nvim_create_augroup('mimivalsi_fugitive', {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd('BufWinEnter', {
|
||||
group = mimivalsi_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)
|
||||
|
||||
vim.keymap.set('n', '<leader>P', function()
|
||||
vim.cmd.Git { 'pull', '--rebase' }
|
||||
end, opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>o', ':Git push -u origin', opts)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', 'gu', '<cmd>diffget //2<CR>')
|
||||
vim.keymap.set('n', 'gh', '<cmd>diffget //3<CR>')
|
||||
end,
|
||||
},
|
||||
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
-- NOTE: Plugins can also be added by using a table,
|
||||
|
|
Loading…
Reference in New Issue