Change readme to suggest lazy loading this plugin with lazy.nvim
The current README suggests disabling lazy loading by default, which I think it does because
- if you configure this plugin to be loaded on entering a typst file, you won't be able to change the rules for following the cursor or download the dependencies without entering a typst file
- if you specify every possible command for lazy loading, the config becomes less readable and less maintainable when introducing other commands
I think it's still good to strive for lazy loading when using a plugin that supports it. Possible solutions are to
- Not care about the problem with cursor rule toggling and just load on entering a typst file (or even better, when executing a command that can start the preview/install dependencies), eventually explain shortly in a comment the problem with this and how to fix it
- Not care about readability and list all of the commands that may start this plugin with the
cmdoption - Like 2, but skip some of the commands in favor of also specifying the typst filetype. This is kind of overengineered and not even completely correct, as technically every command can be succesfully called without opening a typst file in some way
- Not care about lazy loading and leave it as it is
This is a minor issue, but I think it's still worth talking about and I'd like to hear some opinions on this.
EDIT: I now see that #88 has introduced a lazy.lua file with a full and correct specification for this, so if that PR was to merge then adjusting the readme would be much simpler (still required though)
Hmmm, without considering #88, my opinion is that there are two types of user:
- People who don't exactly understand what lazy loading is (I claim that those users makes up an non insignificant portion of users for this plugin). They will copy paste the suggested config in the readme and not think about it.
- If the suggested config suggest lazy loading by default, they might get confused about why the command listed out isn't available without entering a
.typfile.
- If the suggested config suggest lazy loading by default, they might get confused about why the command listed out isn't available without entering a
- People who know what lazy loading is.
- Since the suggested config already indicate the lazy loading is an viable alternative, they'll decided what they want and do that.
My claim is that if you don't know what lazy loading is, you probably don't care that much about startup time. I also claim that this plugin adds very little nvim's startup time.
Now, considering that follow cursor and instant preview both currently still depend on the file being previewed upon is a typst file, and no one that I know of has complained so far, I'm not sure if my arguments still holds up that well.
I think, ideally, either
- Previewing a file that doesn't end in
.typshould be fully supported. - Merge #99, and clarify in the readme that only
.typfiles are supported and also expose an interface for user to specifying an file is a typst file without settingfiletype. Which would coincidentally also close #90.
Hmm, not sure, but I actually lean towards the second option. This will still require some thoughts though. I'll get back to this within a few weeks or months.