diff options
author | kylo252 <[email protected]> | 2021-09-13 11:28:15 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-09-13 11:28:15 +0200 |
commit | 8eed75d67f9cbcefb91c4cb5aac0ffd013be25cc (patch) | |
tree | cba9d98b4b3c6559dc2bd17f1fb557cb88f5387f /lua/plugin-loader.lua | |
parent | 38b0c3d860d10515002fdb27db7e1187ce110b1d (diff) |
refactor: use more flexible paths (#1381)
Diffstat (limited to 'lua/plugin-loader.lua')
-rw-r--r-- | lua/plugin-loader.lua | 26 |
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 |