simplify gitsigns lazyloading

This commit is contained in:
siduck 2022-08-06 08:19:14 +05:30
parent cf5e7e9811
commit df3ae31e94

View file

@ -63,26 +63,13 @@ M.mason_cmds = {
} }
M.gitsigns = function() M.gitsigns = function()
-- taken from https://github.com/max397574
autocmd({ "BufRead" }, { autocmd({ "BufRead" }, {
callback = function() callback = function()
local function onexit(code, _) if vim.fn.isdirectory ".git" ~= 0 then
if code == 0 then
vim.schedule(function() vim.schedule(function()
require("packer").loader "gitsigns.nvim" require("packer").loader "gitsigns.nvim"
end) end)
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)
end
end, end,
}) })
end end