-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for original rtp #145
Comments
You can do what you want with a -- ~/.config/nvim/init.lua
local path_package = vim.fn.stdpath('data') .. '/site/'
local function ensure_installed(plugin, branch)
local user, repo = string.match(plugin, "(.+)/(.+)")
local repo_path = path_package .. 'pack/deps/start/' .. repo
if not (vim.uv or vim.loop).fs_stat(repo_path) then
vim.notify("Installing " .. plugin .. " " .. branch)
local repo_url = "https://github.com/" .. plugin
local out = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--branch=" .. branch,
repo_url,
repo_path
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone " .. plugin .. ":\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
vim.cmd('packadd ' .. repo .. ' | helptags ALL')
vim.cmd('echo "Installed `' .. repo ..'`" | redraw')
end
end
ensure_installed("echasnovski/mini.nvim", "stable")
ensure_installed("rktjmp/hotpot.nvim", "v0.14.6")
require("hotpot") -- Optionally you may call require("hotpot").setup(...) here
require("mini.deps").setup({path = {package = path_package}})
MiniDeps.add({source = "echasnovski/mini.nvim", checkout = "stable"})
MiniDeps.add({source = "rktjmp/hotpot.nvim", checkout = "v0.14.6"}) -- ~/.config/nvim/.hotpot.lua
local data_dir = vim.fn.stdpath("data")
-- setting this to /site/plugin/my_config or something might make it simpler to clean up
local config_in_data_dir = data_dir .. "/site/plugin/my_config/"
-- Important, .hotpot.lua only runs as a "build step" when you save a fnl file
-- in a dir with a .hotpot.lua file somewhere in its parent paths.
-- (eg: its intended use is for shipping plugin lua code, etc)
--
-- It will *not* effect files that are only compiled to the cache dir "just in
-- time" as they're loaded via lua's `require('module')` system.
return {
-- See build docs
-- https://github.com/rktjmp/hotpot.nvim/blob/main/COOKBOOK.md#build
build = {
{verbose = true, atomic = true},
{"fnl/**/*macro*.fnl", false}, -- important, do not compile any macro files
{"fnl/**/*.fnl", function(abs_path)
-- TODO: adjust prefix regex to your own dir
local target_path = string.gsub(abs_path, "^/root/.config/nvim/fnl/", config_in_data_dir)
return target_path
end}
},
-- see docs, set to a glob path to search for unknown lua files
-- note: be careful you don't remove lua files you make yourself or other
-- systems have created.
-- https://github.com/rktjmp/hotpot.nvim/blob/main/COOKBOOK.md#clean
clean = {
{config_in_data_dir .. "**/*.lua", true}
}
} ;; ~/.config/nvim/fnl/hello.fnl
(print :hello) Note you must edit and save You'll see a message showing the source and target paths when |
The above will get your files where you want (you may have to adjust paths to fit your own system), but AFAICT, neovim wont see these files as "lua modules" and just directly loads the source and executes it? They never end up in luas This isn't really an explicitly supported use case of hotpot because its pretty uncommon. IMO either treat the lua files as "inconsequential build artefacts" and let hotpot build them as they're required and put them in the cache dir, or build ahead of time to your (imo, more portable) In terms of "modifying the RTP", hotpot adds one path, pointing to the cache dir, which I think is pretty inconsequential and is done for you. The install instructions for Lazy require adding an additional path because of how Lazy works. |
I'm just wondering, cause I've tried to configure tangerine plugin to do this, couldn't understand even how to with nfnl (aniseed v2) and I think I'm seeing the possibility better with hotpot, but haven't been able to implement it yet (sorry, a bit noob).
Why is not possible just to compile to default rtp? aka .local/share/nvim/site/...
Also, I would like to separate everything as in rtp standard way. My plugins added with or without plugin manager go into /pack, my configurations in /plugin and my shareable stuff that I need to be able to require in different places in /lua (/fnl in my config dir, /lua in rtp).
Maybe it's easier than I've been able to see with hotpot (git gud noob) but if anyone can help me gittin gud I'd appreciate it :)
I don't know, adding new dirs to rtp seems to me kinda dirty without trying this first.
Nice plugin!!! and thanks in advance just for the time reading this :3
The text was updated successfully, but these errors were encountered: