Don't load packer at startup

This commit is contained in:
nullchilly 2022-08-06 10:58:05 +07:00 committed by Sidhanth Rathod
parent 22c3cc0c0d
commit b3d3c5a7dd
3 changed files with 14 additions and 19 deletions

View file

@ -4,6 +4,18 @@ require "core.options"
require("core.utils").load_mappings() require("core.utils").load_mappings()
-- setup packer + plugins -- 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") pcall(require, "custom")

View file

@ -23,7 +23,7 @@ autocmd("FileType", {
-- wrap the PackerSync command to warn people before using it in NvChadSnapshots -- wrap the PackerSync command to warn people before using it in NvChadSnapshots
autocmd("VimEnter", { autocmd("VimEnter", {
callback = function() callback = function()
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync(<f-args>)" vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync(<f-args>)"
end, end,
}) })

View file

@ -1,22 +1,5 @@
local M = {} 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 = { M.options = {
auto_clean = true, auto_clean = true,
compile_on_sync = true, compile_on_sync = true,