Question: How to use lze to load the snacks.nvim? #47
|
Hi there, first of all, thank you for creating nixCats and lze. I'm trying to move from LazyVim to nixCats because I just found how amazing the Nix and NixOS are. Can you please show me what I was missing or how should I do? |
Replies: 2 comments 11 replies
|
Snacks is hard to lazy load. Been trying to figure that out myself. The issue is that if you are using But Id really like to be able to run some of the other ones on a lazy load trigger. If you were to use In short, I think its a plugin design issue with snacks and it cant exactly be lazy loaded, but you can come close sorta, Ill do my best to explain below. Im not sure its worth it, it might still be better to do it at startup, but I still have some tips in the first section below that apply there too. I cannot figure out how to use If you dont use The closest I have found to lazy loading is this. First, put it in Then, at the start of your config you can require require('snacks').bigfile.setup()^careful, I typod it the first time, Then you can make a lze spec that runs the setup function on whatever other triggers you want require('lze').load {
"snacks.nvim",
keys = {
{ '<c-\\>', function() Snacks.terminal() end, mode = { 'n' }, desc = 'open snacks terminal' },
},
after = function(_)
require('snacks').setup({
terminal = { enabled = true, },
})
end,
}since its lua, even if you put it in But so far, this is the best solution I have found. The above is actually not possible in You cant "load it at startup" outside of a spec in We can hack around it a bit in But yeah the design is not at all ideal. |
|
Your answer is great , thank you for your helping! |
Snacks is hard to lazy load. Been trying to figure that out myself.
The issue is that if you are using
bigfileorquickfilesnacks it needs to be loaded at startupBut Id really like to be able to run some of the other ones on a lazy load trigger.
If you were to use
lazy.nvimsnacks still would not load lazily, becausebigfilewould need to be required at startup and this would causelazy.nvimto load it immediately regardless of what you do. So you can either usebigfile/quickfileOR lazy load it inlazy.nvim, not both...In short, I think its a plugin design issue with snacks and it cant exactly be lazy loaded, but you can come close sorta, Ill do my best to explain below. Im not sure i…