diff options
author | christianchiarulli <[email protected]> | 2021-07-18 14:10:19 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-07-18 14:10:19 -0400 |
commit | b797c2398fafaaa3e5f81d9e1630a41240a31bf8 (patch) | |
tree | 3dd23047f7fd09a4b13d4728696751b4f685f3fe /lua/plugin-loader.lua | |
parent | a3f3f3b60cf675e3a80d3285dff136d193cfbb53 (diff) | |
parent | 6f9c521e227b1c4d3741cb73ee0a9598be73ef10 (diff) |
Merge branch 'rolling' of github.com:ChristianChiarulli/LunarVim into rolling
Diffstat (limited to 'lua/plugin-loader.lua')
-rw-r--r-- | lua/plugin-loader.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lua/plugin-loader.lua b/lua/plugin-loader.lua new file mode 100644 index 00000000..25a41111 --- /dev/null +++ b/lua/plugin-loader.lua @@ -0,0 +1,46 @@ +local plugin_loader = {} + +function plugin_loader:init() + 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 + execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) + execute "packadd packer.nvim" + end + + local packer_ok, packer = pcall(require, "packer") + if not packer_ok then + return + end + + packer.init { + -- package_root = require("packer.util").join_paths(vim.fn.stdpath "data", "lvim", "pack"), + git = { clone_timeout = 300 }, + display = { + open_fn = function() + return require("packer.util").float { border = "single" } + end, + }, + } + + self.packer = packer + return self +end + +function plugin_loader:load(configurations) + return self.packer.startup(function(use) + for _, plugins in ipairs(configurations) do + for _, plugin in ipairs(plugins) do + use(plugin) + end + end + end) +end + +return { + init = function() + return plugin_loader:init() + end, +} |