mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 21:00:38 +00:00
simplify gitsigns lazyloading
This commit is contained in:
parent
cf5e7e9811
commit
df3ae31e94
1 changed files with 4 additions and 17 deletions
|
@ -63,25 +63,12 @@ M.mason_cmds = {
|
|||
}
|
||||
|
||||
M.gitsigns = function()
|
||||
-- taken from https://github.com/max397574
|
||||
autocmd({ "BufRead" }, {
|
||||
callback = function()
|
||||
local function onexit(code, _)
|
||||
if code == 0 then
|
||||
vim.schedule(function()
|
||||
require("packer").loader "gitsigns.nvim"
|
||||
end)
|
||||
end
|
||||
end
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
if lines ~= { "" } then
|
||||
vim.loop.spawn("git", {
|
||||
args = {
|
||||
"ls-files",
|
||||
"--error-unmatch",
|
||||
vim.fn.expand "%:p:h",
|
||||
},
|
||||
}, onexit)
|
||||
if vim.fn.isdirectory ".git" ~= 0 then
|
||||
vim.schedule(function()
|
||||
require("packer").loader "gitsigns.nvim"
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue