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,