diff options
author | kylo252 <[email protected]> | 2022-04-20 13:27:51 +0200 |
---|---|---|
committer | kylo252 <[email protected]> | 2022-04-20 13:27:51 +0200 |
commit | ce4f7b0fc82dcc0ec604cd7b576ae5db95ab7235 (patch) | |
tree | 0dbea71a10ac2f3c5e1e2ba21e8d132fa0199f3a /lua/lvim/bootstrap.lua | |
parent | 2567d8612e2f31c024038e54b3dfa4825ff539d6 (diff) | |
parent | 0481ec8dddf4bd8ed81c10ae98807fec97f6f872 (diff) |
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/lvim/bootstrap.lua')
-rw-r--r-- | lua/lvim/bootstrap.lua | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index c324055a..ac6475c7 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -1,7 +1,7 @@ local M = {} -if vim.fn.has "nvim-0.6.1" ~= 1 then - vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.6.1+", vim.log.levels.WARN) +if vim.fn.has "nvim-0.7" ~= 1 then + vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.7+", vim.log.levels.WARN) vim.wait(5000, function() return false end) @@ -35,7 +35,7 @@ function _G.get_runtime_dir() local lvim_runtime_dir = os.getenv "LUNARVIM_RUNTIME_DIR" if not lvim_runtime_dir then -- when nvim is used directly - return vim.fn.stdpath "data" + return vim.call("stdpath", "data") end return lvim_runtime_dir end @@ -45,7 +45,7 @@ end function _G.get_config_dir() local lvim_config_dir = os.getenv "LUNARVIM_CONFIG_DIR" if not lvim_config_dir then - return vim.fn.stdpath "config" + return vim.call("stdpath", "config") end return lvim_config_dir end @@ -55,7 +55,7 @@ end function _G.get_cache_dir() local lvim_cache_dir = os.getenv "LUNARVIM_CACHE_DIR" if not lvim_cache_dir then - return vim.fn.stdpath "cache" + return vim.call("stdpath", "config") end return lvim_cache_dir end @@ -70,6 +70,18 @@ function M:init(base_dir) self.packer_install_dir = join_paths(self.runtime_dir, "site", "pack", "packer", "start", "packer.nvim") self.packer_cache_path = join_paths(self.config_dir, "plugin", "packer_compiled.lua") + ---@meta overridden to use LUNARVIM_x_DIR instead, since a lot of plugins call this function interally + vim.fn.stdpath = function(what) + if what == "cache" then + return _G.get_cache_dir() + elseif what == "data" then + return _G.get_runtime_dir() + elseif what == "config" then + return _G.get_config_dir() + end + return vim.call("stdpath", what) + end + ---Get the full path to LunarVim's base directory ---@return string function _G.get_lvim_base_dir() @@ -78,13 +90,13 @@ function M:init(base_dir) if os.getenv "LUNARVIM_RUNTIME_DIR" then -- vim.opt.rtp:append(os.getenv "LUNARVIM_RUNTIME_DIR" .. path_sep .. "lvim") - vim.opt.rtp:remove(join_paths(vim.fn.stdpath "data", "site")) - vim.opt.rtp:remove(join_paths(vim.fn.stdpath "data", "site", "after")) + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site")) + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site", "after")) vim.opt.rtp:prepend(join_paths(self.runtime_dir, "site")) vim.opt.rtp:append(join_paths(self.runtime_dir, "site", "after")) - vim.opt.rtp:remove(vim.fn.stdpath "config") - vim.opt.rtp:remove(join_paths(vim.fn.stdpath "config", "after")) + vim.opt.rtp:remove(vim.call("stdpath", "config")) + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "config"), "after")) vim.opt.rtp:prepend(self.config_dir) vim.opt.rtp:append(join_paths(self.config_dir, "after")) -- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp @@ -95,10 +107,7 @@ function M:init(base_dir) -- FIXME: currently unreliable in unit-tests if not in_headless then _G.PLENARY_DEBUG = false - require("lvim.impatient").setup { - path = join_paths(self.cache_dir, "lvim_cache"), - enable_profiling = true, - } + require "lvim.impatient" end require("lvim.config"):init() @@ -115,8 +124,10 @@ end ---pulls the latest changes from github and, resets the startup cache function M:update() require_clean("lvim.utils.hooks").run_pre_update() - require_clean("lvim.utils.git").update_base_lvim() - require_clean("lvim.utils.hooks").run_post_update() + local ret = require_clean("lvim.utils.git").update_base_lvim() + if ret then + require_clean("lvim.utils.hooks").run_post_update() + end end return M |