neorg
neorg copied to clipboard
[FEEDBACK WANTED] Always load Neorg?
The general idea
Neorg by default does not load itself upon startup - you have to manually start it through :NeorgStart
, which can also take some optional parameters, like :NeorgStart silent=true
or :NeorgStart workspace=custom-workspace
. This introduces a little more overhead than I think I'd like - perhaps it would be better to always load Neorg? That way you always have access to a :Neorg
command and you don't have to have a special handler for when Neorg isn't loaded vs when it is loaded.
What do you, the community, think of this? Should Neorg not lazy load itself?
Hey @vhyrro!
Would that solve #500 ? That would be nice :)
My only worry is that it would slow down neovim startup time. Would that be the case? I'm using sway and usually open a lot of individual neovim instances (letting sway do the tiling etc.). Often this is just for a quick edit, and if I had to wait for e.g. a second each time, this would feel a bit slow. I don't think currently neorg files open slowly on my computer, but I probably only have ~50 .norg files in my workspaces. Would this scale well if I had, say, a 1000 of them?
To be entirely honest I don't have a full answer, but i highly speculate that you will not see any slowdowns (or, even if you did, they would be minuscule). The things that commonly eat up the most startup time are things that actually operate on Neorg buffers (the concealer, core.syntax, keybindings etc.). Very few modules actually do anything special upon loading. One module that probably would affect startup time the most would be core.highlights
, as it has to churn through a lot of nested tables and run a lot of nvim_set_hl
/vim.cmd.highlight
calls.
I should have some time to do more serious profiling today. If I get around to it I'll post the results here :)
Edit: yes, i think removing the lazy loading should also solve #500 :smile:
If the slowdowns are minor, then I think the advantages really speak for removing lazy-loading! :)
imo this is a really bad thing because neorg has some dependencies e.g. for the completion module if you now have to load this the slowdowns are huge if you don't want to load them things get really complicated
Unless you make a significant improvement on startup time, I think it's not worth it. At the moment Neorg still behave very nice to me even though ladyloaded ☺️
Maybe load the basic modules of neorg (dirman and similar), then only load the editing and others when a norg file is opened? I don't see why we would have to load core.highlights
or something if neorg isn't accessed at all for a NeoVim session
I don't know where my mind was I completely forgot about package manager lazyloading since I'd just do that I rly like the idea of doing what's suggested here because it always was a pain with handling neorg being loaded (package manager) but not loaded (NeorgStart) or similar things
core.highlights
can easily get refactored to trigger on BufEnter versus evaluating everything right out the gate. I don't believe there should be behaviour to load the "basic" modules, since all modules should be treated equal. I'll make sure that startup time isn't drastically affected, and I might flip the switch on this. It makes Neorg much easier in many aspects.
This has since been implemented! See #586 for more details. With this we can work on implementing some sophisticated workflows. I have a few ideas in mind already :D