Open rktjmp opened 11 months ago
@monkoose, not sure if you are still using hotpot, do you have a particularly large amount of complex macros?
Looking at this line, we have to clear the in-memory versions of macros each time we build and can be expensive to code-gen.
I do use it, but I have converted it to use .hotpot.lua only and compile on demand, and compile into /lua directory and not use any cache files. It requires some workaround in init.lua, but after that it works like a charm, doesn't preload hotpot on neovim startup and compiles when any fennel file in my config was changed.
And maybe it was some macro issue, because previously I have used vim.api
functions in some of my macros and with such option to make it work like that
compiler = {
macros = {
env = "_COMPILER",
compilerEnv = _G,
allowedGlobals = false,
},
},
But after I have realized that this is wrong approach and it messes up with other fennel compilers (from aniseed or fennel-ls) I have fixed it, but I have already switched to using hotpot only on demand, so can't be sure that it was the issue.
My init.lua looks like this (there is workaround to make neovim work on first startup, when there are missing compiled files)
vim.loader.enable()
local plugins_path = vim.fn.stdpath("data") .. "/lazy"
local config_path = vim.fn.stdpath("config")
-- Bootstrap lazy.nvim
local lazy_path = plugins_path .. "/lazy.nvim"
if not vim.loop.fs_stat(lazy_path) then
vim.notify("Fetching lazy.nvim...", vim.log.levels.INFO)
vim.fn.system({
"git",
"clone",
"--depth=1",
"--filter=blob:none",
"--single-branch",
-- "--branch=stable", -- latest stable release
"https://github.com/folke/lazy.nvim.git",
lazy_path,
})
end
vim.opt.runtimepath:prepend(lazy_path)
local ok, plugins = pcall(require, "plugins.lazy")
if not ok then
vim.print(plugins)
plugins = {
{
"rktjmp/hotpot.nvim",
dependencies = "monkoose/parsley",
config = function() require("hotpot.api.make").auto.build(config_path) end,
},
}
end
require("lazy").setup({
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"zipPlugin",
"matchparen",
"tutor",
"matchit",
"tohtml",
"rplugin",
},
},
},
ui = { border = {'┏', '━', '┓', '┃', '┛', '━', '┗', '┃'} },
spec = plugins,
})
require("conf.options")
require("statusline")
require("conf.autocmds")
require("conf.maps")
.hotpot.lua
return {
compiler = {
macros = {
env = "_COMPILER",
compilerEnv = _G,
},
},
build = {
{atomic = true},
{"fnl/**/*macros.fnl", false},
{"fnl/**/*.fnl", true},
{"colors/*.fnl", true},
{"after/**/*.fnl", true},
},
clean = {
{"lua/**/*.lua", true}
}
}
Discussed in https://github.com/rktjmp/hotpot.nvim/discussions/116
My current (rather convoluted)
```lua vim.loader.enable() local function bootstrap(plugin) local _, name = unpack(vim.split(plugin, '/')) local plugin_path = vim.fn.stdpath('data')..'/lazy/'..name if not vim.loop.fs_stat(plugin_path) then vim.notify('Installing '..plugin..' to '..plugin_path, vim.log.levels.INFO) vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--single-branch', 'https://github.com/'..plugin, plugin_path, }) end vim.opt.runtimepath:prepend(plugin_path) end bootstrap('folke/lazy.nvim') bootstrap('rktjmp/hotpot.nvim') require('hotpot').setup({ provide_require_fennel = true, -- BTW `:StartupTime` shows that `hotpot.fennel` takes up ~70ms even this is not set -- only happens on >0.8.0 }) local plugins = { { 'rktjmp/hotpot.nvim' }, } local plugin_def_path = vim.fn.stdpath('config')..'/fnl/config/plugins' if vim.loop.fs_stat(plugin_def_path) then for file in vim.fs.dir(plugin_def_path) do local name = file:match("^(.*)%.fnl$") plugins[#plugins + 1] = require("config.plugins."..name) end end require('lazy').setup(plugins) require('config') ```init.lua
withlazy.nvim
andhotpot.nvim