mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 04:46:45 +00:00
feat: spec.rocks is no longer needed & added support for installing any luarock
This commit is contained in:
parent
b3ee5b96f2
commit
fcfd54835d
10 changed files with 120 additions and 235 deletions
|
@ -69,9 +69,8 @@ function M.install_missing()
|
|||
for _, plugin in pairs(Config.plugins) do
|
||||
local installed = plugin._.installed
|
||||
local has_errors = Plugin.has_errors(plugin)
|
||||
local rocks_installed = plugin._.rocks_installed ~= false
|
||||
|
||||
if not has_errors and not (installed and rocks_installed) then
|
||||
if not has_errors and not (installed and not plugin._.build) then
|
||||
for _, colorscheme in ipairs(Config.options.install.colorscheme) do
|
||||
if colorscheme == "default" then
|
||||
break
|
||||
|
@ -344,6 +343,10 @@ function M._load(plugin, reason, opts)
|
|||
|
||||
M.add_to_rtp(plugin)
|
||||
|
||||
if plugin._.pkg and plugin._.pkg.source == "rockspec" then
|
||||
M.add_to_luapath(plugin)
|
||||
end
|
||||
|
||||
if plugin.dependencies then
|
||||
Util.try(function()
|
||||
M.load(plugin.dependencies, {})
|
||||
|
@ -487,6 +490,15 @@ function M.add_to_rtp(plugin)
|
|||
vim.opt.rtp = rtp
|
||||
end
|
||||
|
||||
---@param plugin LazyPlugin
|
||||
function M.add_to_luapath(plugin)
|
||||
local root = Config.options.rocks.root .. "/" .. plugin.name
|
||||
local path = root .. "/share/lua/5.1"
|
||||
local cpath = root .. "/lib/lua/5.1"
|
||||
package.path = package.path .. ";" .. path .. "/?.lua;" .. path .. "/?/init.lua;"
|
||||
package.cpath = package.cpath .. ";" .. cpath .. "/?." .. (jit.os:find("Windows") and "dll" or "so") .. ";"
|
||||
end
|
||||
|
||||
function M.source(path)
|
||||
Util.track({ runtime = path })
|
||||
Util.try(function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue