Closed pmatulis closed 2 years ago
You're right: I never imagined this feature (and don't find it interesting myself).
The closest thing we have right now is g:wiki_journal.date_format
, but it will only specify the file name and does not support nested directories.
I could look into allowing format strings that contain path delimiters /
and create directories as needed. However, it would not be "backwards compatible", that is, you would have to fix any existing entries manually.
I imagine it to work like this:
*g:wiki_journal*
A dictionary for configuring the journal/diary feature. Available options
are:
...
date_format~
Dictionary of filename formats for the 'daily', 'weekly', and 'monthly'
frequencies. The formats may contain the following keys:
%y year (two digits)
%Y year (four digits)
%m month (01..12)
%d day of month (01..31)
%V ISO week number with Monday as first day of week
%U week number with Sunday as first day of week
/ Path delimiter
The filenames will be rooted at the journal root.
The following example will specify to create journal entries in a path
hierarchy:
let g:wiki_journal = {
\ 'name': 'journal',
\ 'frequency': 'daily',
\ 'date_format': {
\ 'daily' : '%Y/%m/%d',
\ 'weekly' : '%Y/week_%V',
\ 'monthly' : '%Y/%m/summary',
\ },
\ 'index_use_journal_scheme': v:true,
\}
The journal files would then look something like this:
wiki/journal/
-> 2021/
-> 04/
-> 25.wiki
-> 26.wiki
-> 2022/
-> 06/
-> 25.wiki
-> 26.wiki
Is this aligned with your expectation; what you want?
Yes, you got it. 👍
I've looked into this now, and I notice that I did not really plan for this kind of thing. There are a lot of changes required to support it. I'll admit this is caused by a poor design of the journal code. I might consider to make a large update, but I won't promise anything.
Essentially: I've mostly assumed a ISO standard date for most things. I should have designed a mapping between a date (in various formats) and a journal file name. When you define the date_format
differently, things like "go to next entry" and most type of journal links will stop working.
I'll leave the issue open, and I might go ahead and address this. But, again, I won't make any promises. It will take some time and I'm not blessed with much of that these days.
I understand.
Will custom wiki resolver do this? It may be the easiest workaround.
It may result in a path that hasn't yet been created, but maybe Vim has a method to do it?
No, it's not that simple. Or, rather, that's not the problem. You can already set the setting as I suggested in my first post and it will seem to work. But doing :WikiJournalNext
and similar will not work with this format. Further, the journal scheme links assumes a link in the same format as the setting, so journal:YYYY-MM-DD
would stop working. And other things. So, as I said, I've done some silly choices when I implemented these things, and I think the best way forward is to change the implementation at core of the journal. I think doing this would both improve the plugin a lot and also allow for future improvements and new features, so I believe I might go there. But likely not very fast.
I might recommend the jrnl.sh program as an alternative CLI journal, if you are using vim in CLI.
I've pushed a branch with updates that I believe should allow journal hierarchies. I would be very happy if someone would be willing to test it.
See #249.
I'm merging #249 after testing it for a day or two. It seems to work as intended for me - or, at least, it does not break my personal workflows. Please feel free to open new issues if things do not work as expect!
It is not clear whether there is support for a directory hierarchy for journal files. It doesn't seem workable to have one directory (
wiki_root/journal
appears to be the default for<journal-dir>
) that contains an ever-growing number of files. It would be great to have built-in support for journal file creation under:<journal-dir>/<year>/<month>