diff --git a/.config/nvim/lua/plugin/packer.lua b/.config/nvim/lua/plugin/packer.lua index 0af119b..91a1a3e 100644 --- a/.config/nvim/lua/plugin/packer.lua +++ b/.config/nvim/lua/plugin/packer.lua @@ -4,14 +4,19 @@ -- Description : neovim plugins file -local execute = vim.api.nvim_command -local fn = vim.fn - -local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim" - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path}) - execute "packadd packer.nvim" +local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + print("Cloning packer...") + PACKER_BOOTSTRAP = vim.fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + }) + vim.cmd([[packadd packer.nvim]]) + print("Done.") end return require("packer").startup(function() @@ -102,4 +107,10 @@ return require("packer").startup(function() "norcalli/nvim-colorizer.lua", cmd = "ColorizerToggle" } + + + -- automatically setup the config after cloning + if PACKER_BOOTSTRAP then + require("packer").sync() + end end)