preload.lua 705 B

123456789101112131415161718192021222324252627
  1. local ensure_packer = function()
  2. local fn = vim.fn
  3. local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
  4. if fn.empty(fn.glob(install_path)) > 0 then
  5. fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
  6. vim.cmd [[packadd packer.nvim]]
  7. return true
  8. end
  9. return false
  10. end
  11. ncvim.packer_bootstrap = ensure_packer()
  12. if ncvim.packer_bootstrap then
  13. require('core.plugins')
  14. require('packer').sync()
  15. end
  16. -- require only if module exists
  17. local function loadrequire(module)
  18. local function requiref(module_to_require)
  19. require(module_to_require)
  20. end
  21. pcall(requiref, module)
  22. end
  23. loadrequire('impatient')