Closed datwaft closed 1 year ago
That's not possible with lazy and would require too many loopholes to make this work.
I found a workaround:
init.lua
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
-- Add lazy.nvim to rtp
vim.opt.runtimepath:prepend(lazypath)
-- Configure lazy.nvim
require("lazy").setup("conf.plugins", {
performance = {
cache = {
enabled = false,
},
},
})
if pcall(require, "hotpot") then
-- Initialize hotpot
require("hotpot").setup({
provide_require_fennel = true,
enable_hotpot_diagnostics = false,
})
-- Compile plugin configurations
-- This is required because Lazy requires in some way those plugins and hotpot doesn't detect that they have been required
for file in vim.fs.dir(vim.fn.stdpath("config") .. "/fnl/conf/plugins") do
file = file:match("^(.*)%.fnl$")
require("conf.plugins." .. file)
end
-- Execute configuration
require("conf")
else
vim.notify(table.concat({
"Plugin `hotpot.nvim` could not be required.",
"Make sure that hotpot is installed using `:Lazy`.",
"The configuration won't be loaded."
}, "\n"), vim.log.levels.WARN)
end
lua/conf/plugins/hotpot.lua
return {
"rktjmp/hotpot.nvim",
dependencies = {
"datwaft/themis.nvim",
},
}
This works perfectly (for anything that is a plugin module) but I am having two issues with Lazy using Fennel plugin modules:
-- Compile plugin configurations
-- This is required because Lazy requires in some way those plugins and hotpot doesn't detect that they have been required
for file in vim.fs.dir(vim.fn.stdpath("config") .. "/fnl/conf/plugins") do
file = file:match("^(.*)%.fnl$")
require("conf.plugins." .. file)
end
.fnl
files.Here is the compiled output of fnl/conf/plugins/treesitter.fnl
:
local function config()
local treesitter = require("nvim-treesitter.configs")
return treesitter.setup({ensure_installed = "all", highlight = {enable = true}, rainbow = {enable = true}, context_commentstring = {enable = true}, indent = {enable = false}, yati = {enable = true}})
end
return {{build = ":TSUpdate", config = config, dependencies = {"p00f/nvim-ts-rainbow", "JoosepAlviste/nvim-ts-context-commentstring", "yioneko/nvim-yati"}, "nvim-treesitter/nvim-treesitter"}}
It can be found in ~/.cache/nvim/hotpot/Users/datwaft/.config/nvim.lazy/fnl/conf/plugins/treesitter.lua
.
I know it is not being detected because :Lazy
doesn't show treesitter.
Should I open a new issue?
Both lazy and fennel add package loaders, which probably interfer.
You can try disabling the lazy cache and see if that works.
As you can see in the example I have the cache disabled:
-- Configure lazy.nvim
require("lazy").setup("conf.plugins", {
performance = {
cache = {
enabled = false,
},
},
})
Is your feature request related to a problem? Please describe. Hello!
I am thinking about migrating my Neovim configuration to this package manager but my Neovim configuration uses Fennel with hotpot.nvim. That means that I have some plugins that I must have installed before the
plugins
module can be compiled.My idea is to do something like...
...which would always install hotpot.nvim for me and then would use the compiled
conf.plugins
module.Describe the solution you'd like It would be ideal to be able to specify some plugins inside the
init.lua
file and a module containing plugins to load.Describe alternatives you've considered I have considered bootstrapping hotpot.nvim but I am not sure of what the best practice for this would be.
If I am able to do that I could load lazy.nvim inside
fnl/conf/init.fnl
.Additional context I have already setup a Lua demo configuration and I am loving this plugin. 😄