diff options
| author | kylo252 <[email protected]> | 2022-04-20 13:22:26 +0200 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-20 13:22:26 +0200 | 
| commit | 0481ec8dddf4bd8ed81c10ae98807fec97f6f872 (patch) | |
| tree | 10a85cd7266f288a9b49e9658a377413854622ba /lua/lvim/bootstrap.lua | |
| parent | 3d841425aed288091068bbb8d15376c9908c6cec (diff) | |
refactor: update impatient (#2477)
Diffstat (limited to 'lua/lvim/bootstrap.lua')
| -rw-r--r-- | lua/lvim/bootstrap.lua | 31 | 
1 files changed, 20 insertions, 11 deletions
| diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 83536335..ac6475c7 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -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() | 
