From df3ae31e941a06fd4fe22f565598626460979002 Mon Sep 17 00:00:00 2001 From: siduck Date: Sat, 6 Aug 2022 08:19:14 +0530 Subject: [PATCH] simplify gitsigns lazyloading --- lua/core/lazy_load.lua | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/lua/core/lazy_load.lua b/lua/core/lazy_load.lua index 84d5f009..049813d6 100644 --- a/lua/core/lazy_load.lua +++ b/lua/core/lazy_load.lua @@ -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, })