Closed dncnmcdougall closed 1 year ago
Because I don't put my id's in the title and I use a very general regex for the id ("%w+") I got very weird results for the id initially. This is another reason why I implemented the explicit flags.
Also I have been building my own zettlekasten code (as one does) and thought I would look at your vim plugin to use ideas from it for my front end. But the more I looked the more I really liked your code and so have decided to use it directly. This is really well written. And full! Thank you.
Excellent thank you for these comments. May I try and summarise:
id_in_title
and id_in_filename
to be true at the same time.stylua
As a solution to 1. and 4. we could use an enum. Something like:
{infer_id} (optional| integer) This is a flag to determine where the id should be inferred from. Set to 0 it is inferred from the > title. Set to 1 it is inferred from the filename. Default: 0
This keeps it simple in that there can no longer be a mismatch (because we never check both.) Of course that means that we do not check that these are in sync. But that is not done at the moment either.
3 is easy to fix. I think in this case explicit parameters will work best. I will figure out 2. A styler is a boon worth investing in indeed.
Excellent thank you for these comments. May I try and summarise:
1. don't allow `id_in_title` and `id_in_filename` to be true at the same time. 2. run `stylua` 3. don't pass the whole config dictionary in, rather either explicit parameters or silently (invisibly) get the config internally. 4. on mismatch of id's report the error more gracefully so that the plugin may still load. Does this capture all your points? (It is wonderful having a good review, thank you for the effort.)
This summarizes it perfectly!
As a solution to 1. and 4. we could use an enum. Something like:
{infer_id} (optional| integer) This is a flag to determine where the id should be inferred from. Set to 0 it is inferred from the > title. Set to 1 it is inferred from the filename. Default: 0
This keeps it simple in that there can no longer be a mismatch (because we never check both.) Of course that means that we do not check that these are in sync. But that is not done at the moment either.
I think that's a good solution. Since we use the file names for jumping between different files, the mismatch for the id
in the title and the id
in the file name shouldn't matter.
3 is easy to fix. I think in this case explicit parameters will work best.
Thank you.
I will figure out 2. A styler is a boon worth investing in indeed.
All you need to do is install stylua and just run :!stylua %
in Vim. It'll pick up the appropriate configuration file automatically.
Excellent it has been a pleasure working on this with you.
In particular all three regex expressions used in browse have been moved to config. I also added options to specify whether to use the filename and the title to determine the id. The default is to use both. When both are used they are checked against each other. If they differ an error is raised.
I store my ids only in the filename, which is why I introduced this.