feat: add macOS and Windows shared object support in rocks configuration

This commit is contained in:
2024-08-31 03:03:24 -04:00
parent b79f65f3a8
commit bb22965c0f
+9 -9
View File
@@ -4,18 +4,12 @@
-- ━━━━━━━━━━━━━━━━━━━━━━━━ Bootstrap rocks.nvim ━━━━━━━━━━━━━━━━━━━━━
do
-- Specifies where to install/use rocks.nvim
---@diagnostic disable-next-line: param-type-mismatch
local install_location = vim.fs.joinpath(vim.fn.stdpath("data"), "rocks")
-- Set up configuration options related to rocks.nvim (recommended to leave as default)
local rocks_config = {
rocks_path = vim.fs.normalize(install_location),
rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks",
}
vim.g.rocks_nvim = rocks_config
-- Configure the package path (so that plugin code can be found)
local luarocks_path = {
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath(
@@ -29,14 +23,17 @@ do
}
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
-- Configure the C path (so that e.g. tree-sitter parsers can be found)
local luarocks_cpath = {
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
-- Remove the dylib and dll paths if you do not need macos or windows support
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dylib"),
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"),
}
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
-- Load all installed plugins, including rocks.nvim itself
vim.opt.runtimepath:append(
vim.fs.joinpath(
rocks_config.rocks_path,
@@ -75,3 +72,6 @@ if not pcall(require, "rocks") then
vim.fn.delete(rocks_location, "rf")
end
-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Load plugins ━━━━━━━━━━━━━━━━━━━━━━━━━
require("rocks")