nvim-telekasten / telekasten.nvim

A Neovim (lua) plugin for working with a markdown zettelkasten / wiki and mixing it with a journal, based on telescope.nvim
MIT License
1.37k stars 86 forks source link

Add follow_date() picker for journal entries #45

Closed lambtho12 closed 2 years ago

lambtho12 commented 2 years ago

If the journal is not a subdirectory of the home zettelkasten, it is not possible to use follow_link() to open a link to a daily/weekly note, as follow_link() looks for files in the ZK home directory.

A new picker should therefore be created to open journal entries. Note that, as the filename format of the journal entries is hardcoded, a single picker could be implemented. The picker would parse the link and determine whether it has to look inside the dailies or weeklies directory.

renerocksai commented 2 years ago

That is only partly true. resolve_link() will find the note; it is just that later when the picker is called, the ZK home is passed to the picker, based on the assumption that it applies to all notes.

The plugin just was not made for journals that don't share a common root.

I don't think a new picker would be a good solution. Instead, resolve_link() should return the root dir it found the note in: home, dailies, weeklies - and have follow_link() pass that on to the picker.

renerocksai commented 2 years ago

Just some additional info: Currently, there is no way for telescope to look in 2 or more unrelated folders. If the dailies and weeklies would be unrelated and you would call the new picker, that could be a problem: what cwd to pass in? So a simple picker might not have cut it anyway - one would have scan_dir()ed both dailies and weeklies and used a table picker instead.

Anyway: the find_daily_notes() and find_weekly_notes() can be used to insert links in such a setup - and with a patch to follow_link(), everything should work.

lambtho12 commented 2 years ago

Ah yes, I didn't check resolve_link. A simple patch to follow_link() should be more than enough.

Yes I use find_daily_notes() already, all is good with this one.

I stumbled across this issue because I added links to prevday and nextday in the template of my daily notes so I can easily access these when editing a specific note, and I was not able to follow_link() to open them.

renerocksai commented 2 years ago

That should be fixed soon.

However, as I mentioned elsewhere (PR #44 ) I think: This won't fix being unable to search_notes() or search for tags in directories outside of the ZK home. We would have to implement a is-not-related detection and find a way to grep in multiple directories for search_notes() - and also search for tags in multiple directories.

I think a smarter option might be: putting symbolic links to your journal into your ZK home.

renerocksai commented 2 years ago
$ zkh= YOUR ZK HOME
$ journal= YOUR JOURNAL DIR
$ cd $zkh
$ ln -s $journal journal_notes

And then configure the journal_notes subdir as daily (and weekly) directory.

lambtho12 commented 2 years ago

I think a smarter option might be: putting symbolic links to your journal into your ZK home.

Definitely! I did not thought of that before 😅. I will do it right away.

renerocksai commented 2 years ago

In addition, I just implemented the fix discussed above :smile: