mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat: luarocks support
This commit is contained in:
parent
8eba74c3fc
commit
f1ba2e3d05
7 changed files with 177 additions and 2 deletions
|
@ -31,6 +31,9 @@ M.defaults = {
|
|||
-- increase downloads a lot.
|
||||
filter = true,
|
||||
},
|
||||
rocks = {
|
||||
root = vim.fn.stdpath("data") .. "/lazy-rocks",
|
||||
},
|
||||
dev = {
|
||||
---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
|
||||
path = "~/projects",
|
||||
|
@ -212,6 +215,9 @@ M.mapleader = nil
|
|||
---@type string
|
||||
M.maplocalleader = nil
|
||||
|
||||
---@type {specs:string, tree:string, path:string, cpath:string}
|
||||
M.rocks = {}
|
||||
|
||||
function M.headless()
|
||||
return #vim.api.nvim_list_uis() == 0
|
||||
end
|
||||
|
@ -262,6 +268,17 @@ function M.setup(opts)
|
|||
M.mapleader = vim.g.mapleader
|
||||
M.maplocalleader = vim.g.maplocalleader
|
||||
|
||||
M.rocks = {
|
||||
specs = M.options.rocks.root .. "/specs",
|
||||
tree = M.options.rocks.root .. "/tree",
|
||||
path = M.options.rocks.root .. "/tree/share/lua/5.1",
|
||||
cpath = M.options.rocks.root .. "/tree/lib/lua/5.1",
|
||||
}
|
||||
vim.fn.mkdir(M.rocks.specs, "p")
|
||||
vim.fn.mkdir(M.rocks.tree, "p")
|
||||
package.path = package.path .. ";" .. M.rocks.path .. "/?.lua;" .. M.rocks.path .. "/?/init.lua;"
|
||||
package.cpath = package.cpath .. ";" .. M.rocks.cpath .. "/?." .. (jit.os:find("Windows") and "dll" or "so") .. ";"
|
||||
|
||||
if M.headless() then
|
||||
require("lazy.view.commands").setup()
|
||||
end
|
||||
|
|
|
@ -44,6 +44,7 @@ function M.setup()
|
|||
while M.install_missing() do
|
||||
count = count + 1
|
||||
if count > 5 then
|
||||
Util.error("Too many rounds of missing plugins")
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -66,7 +67,11 @@ end
|
|||
-- multiple rounds can happen when importing a spec from a missing plugin
|
||||
function M.install_missing()
|
||||
for _, plugin in pairs(Config.plugins) do
|
||||
if not (plugin._.installed or Plugin.has_errors(plugin)) then
|
||||
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
|
||||
for _, colorscheme in ipairs(Config.options.install.colorscheme) do
|
||||
if colorscheme == "default" then
|
||||
break
|
||||
|
|
|
@ -570,6 +570,8 @@ function M.update_state()
|
|||
installed[name] = nil
|
||||
end
|
||||
|
||||
require("lazy.manage.rocks").update_state()
|
||||
|
||||
Config.to_clean = {}
|
||||
for pack, dir_type in pairs(installed) do
|
||||
table.insert(Config.to_clean, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue