summaryrefslogtreecommitdiff
path: root/lua/plugin-loader.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/plugin-loader.lua')
-rw-r--r--lua/plugin-loader.lua26
1 files changed, 12 insertions, 14 deletions
diff --git a/lua/plugin-loader.lua b/lua/plugin-loader.lua
index aa1e888d..5921e9f1 100644
--- a/lua/plugin-loader.lua
+++ b/lua/plugin-loader.lua
@@ -1,9 +1,13 @@
local plugin_loader = {}
-function plugin_loader:init()
- local install_path = "~/.local/share/lunarvim/site/pack/packer/start/packer.nvim"
- if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
- vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
+function plugin_loader:init(opts)
+ opts = opts or {}
+
+ local package_root = opts.package_root or vim.fn.stdpath "data" .. "/site/pack"
+ local compile_path = opts.compile_path or vim.fn.stdpath "config" .. "/plugin/packer_compile.lua"
+
+ if vim.fn.empty(vim.fn.glob(package_root)) > 0 then
+ vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", package_root }
vim.cmd "packadd packer.nvim"
end
@@ -12,15 +16,13 @@ function plugin_loader:init()
return
end
- local util = require "packer.util"
-
packer.init {
- package_root = util.join_paths "~/.local/share/lunarvim/site/pack/",
- compile_path = util.join_paths("~/.config/lvim", "plugin", "packer_compiled.lua"),
+ package_root = package_root,
+ compile_path = compile_path,
git = { clone_timeout = 300 },
display = {
open_fn = function()
- return util.float { border = "rounded" }
+ return require("packer.util").float { border = "rounded" }
end,
},
}
@@ -39,8 +41,4 @@ function plugin_loader:load(configurations)
end)
end
-return {
- init = function()
- return plugin_loader:init()
- end,
-}
+return plugin_loader