improving startup time by using lazy loading or filetype loading
This commit is contained in:
parent
bdb655c5a1
commit
7f1b34fd6f
62 changed files with 1285 additions and 561 deletions
|
|
@ -2,5 +2,46 @@ return {
|
|||
'tpope/vim-fugitive',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
|
||||
end
|
||||
|
||||
local jfraeys_fugitive = vim.api.nvim_create_augroup('jfraeys_fugitive', {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd('BufWinEnter', {
|
||||
group = jfraeys_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,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', 'gu', '<cmd>diffget //2<CR>')
|
||||
vim.keymap.set('n', 'gh', '<cmd>diffget //3<CR>')
|
||||
end,
|
||||
cond = function()
|
||||
-- Function to check if the current directory is a Git repository
|
||||
local is_git_repo = function()
|
||||
local git_dir = vim.fn.finddir('.git', '.;')
|
||||
return git_dir and #git_dir > 0
|
||||
end
|
||||
return is_git_repo()
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue