Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Journal frequency config #141

Open
cherryramatisdev opened this issue Jul 21, 2023 · 3 comments
Open

[Feature request] Journal frequency config #141

cherryramatisdev opened this issue Jul 21, 2023 · 3 comments

Comments

@cherryramatisdev
Copy link

cherryramatisdev commented Jul 21, 2023

Hi! I'd like to propose a new feature that would enhance the journal functionality by allowing users to maintain entries in weekly, monthly, and yearly formats instead of being limited to daily entries only.

Vimwiki has already implemented a similar feature with their diary option. You can check it out here: Vimwiki Diary PR. Additionally, org-journal provides a (setq org-journal-file-type 'weekly) option to achieve similar behavior.

Currently, I have a custom extension in my configuration that mimics this functionality. It works as follows:

fun! GetStartOfTheWeek(timestamp) abort
  return system('start-of-week ' . a:timestamp)->trim()
endfun

fun! GetJournalHeader() abort
  let l:day_of_the_week = strftime("%A")

  let l:has_header = system('grep ' . l:day_of_the_week . ' ' . expand('~/dotoo/journal/' . GetStartOfTheWeek(localtime()) . '.dotoo')) != ""

  if l:has_header
    return ''
  else
    return '* ' . l:day_of_the_week
  endif
endfun

let g:dotoo#capture#templates = {
  \ 'j': {
  \ 'description': 'Journal Entry',
  \ 'lines': [GetJournalHeader(), '** ' . strftime('%H:%m') . ' %?'],
  \ 'target': 'journal/' . GetStartOfTheWeek(localtime()) . '.dotoo',
  \ 'append': 1,
  \ },
}

With this extension, whenever I create a new journal entry, it opens the file for the beginning of the week (Monday) and automatically adds an interactive first heading with the current week's name if it's not already present.

For a clearer understanding of this feature, I've created a demo for you: Asciinema Demo.

I believe this functionality could be a valuable addition to the plugin. If something similar already exists or if you have any suggestions or feedback, please feel free to let me know! I would be more than happy to contribute in any way I can.

@dhruvasagar
Copy link
Owner

@cherryramatisdev This looks quite nice. Thanks, i'll try to add this to dotoo itself. If you think you're up to raising a PR, go for it!

@cherryramatisdev
Copy link
Author

i'll look into the codebase and try to open a PR for sure! thanks for the feedback

@dhruvasagar
Copy link
Owner

Are you still using this ? Any plans on creating a PR soon ? Hacktoberfest is on, let me know if you can take this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants