mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 04:46:45 +00:00
perf(rocks): vim.fn.executable
is slow on WSL2, so only check for luarocks
when needed. Closes #1585
This commit is contained in:
parent
8dd947fccd
commit
9ab3061690
4 changed files with 21 additions and 11 deletions
|
@ -49,8 +49,11 @@ M.defaults = {
|
|||
enabled = true,
|
||||
root = vim.fn.stdpath("data") .. "/lazy-rocks",
|
||||
server = "https://nvim-neorocks.github.io/rocks-binaries/",
|
||||
-- use hererocks to install luarocks.
|
||||
hererocks = vim.fn.executable("luarocks") == 0,
|
||||
-- use hererocks to install luarocks?
|
||||
-- set to `nil` to use hererocks when luarocks is not found
|
||||
-- set to `true` to always use hererocks
|
||||
-- set to `false` to always use luarocks
|
||||
hererocks = nil,
|
||||
},
|
||||
dev = {
|
||||
---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects
|
||||
|
@ -218,6 +221,13 @@ M.defaults = {
|
|||
debug = false,
|
||||
}
|
||||
|
||||
function M.hererocks()
|
||||
if M.options.rocks.hererocks == nil then
|
||||
M.options.rocks.hererocks = vim.fn.executable("luarocks") == 0
|
||||
end
|
||||
return M.options.rocks.hererocks
|
||||
end
|
||||
|
||||
M.version = "11.8.1" -- x-release-please-version
|
||||
|
||||
M.ns = vim.api.nvim_create_namespace("lazy")
|
||||
|
|
|
@ -336,16 +336,16 @@ function M.load()
|
|||
end
|
||||
|
||||
-- add hererocks when enabled and needed
|
||||
if Config.options.rocks.hererocks then
|
||||
for _, plugin in pairs(Config.spec.plugins) do
|
||||
if plugin.build == "rockspec" then
|
||||
for _, plugin in pairs(Config.spec.plugins) do
|
||||
if plugin.build == "rockspec" then
|
||||
if Config.hererocks() then
|
||||
Config.spec.meta:add({
|
||||
"luarocks/hererocks",
|
||||
build = "rockspec",
|
||||
lazy = true,
|
||||
})
|
||||
break
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue