From b3d3c5a7dd4a5abccc6d17b199b4e6ad66fcedfc Mon Sep 17 00:00:00 2001 From: nullchilly Date: Sat, 6 Aug 2022 10:58:05 +0700 Subject: [PATCH] Don't load packer at startup --- init.lua | 14 +++++++++++++- lua/core/init.lua | 2 +- lua/core/packer.lua | 17 ----------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index 10e2b9d..b80c53d 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,18 @@ require "core.options" require("core.utils").load_mappings() -- setup packer + plugins -require("core.packer").bootstrap() +local fn = vim.fn +local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" + +if fn.empty(fn.glob(install_path)) > 0 then + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) + print "Cloning packer .." + fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path } + + -- install plugins + compile their configs + vim.cmd "packadd packer.nvim" + require "plugins" + vim.cmd "PackerSync" +end pcall(require, "custom") diff --git a/lua/core/init.lua b/lua/core/init.lua index a26beb5..0e30564 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -23,7 +23,7 @@ autocmd("FileType", { -- wrap the PackerSync command to warn people before using it in NvChadSnapshots autocmd("VimEnter", { callback = function() - vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync()" + vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync()" end, }) diff --git a/lua/core/packer.lua b/lua/core/packer.lua index 4f68b66..33bfa38 100644 --- a/lua/core/packer.lua +++ b/lua/core/packer.lua @@ -1,22 +1,5 @@ local M = {} -M.bootstrap = function() - local fn = vim.fn - local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" - - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) - - if fn.empty(fn.glob(install_path)) > 0 then - print "Cloning packer .." - fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path } - - -- install plugins + compile their configs - vim.cmd "packadd packer.nvim" - require "plugins" - vim.cmd "PackerSync" - end -end - M.options = { auto_clean = true, compile_on_sync = true,