lervag / wiki.vim

A wiki plugin for Vim
MIT License
660 stars 69 forks source link

Journal Summary Flakiness #203

Closed donniep closed 2 years ago

donniep commented 2 years ago

Thank you for this very useful plugin. NVIM v0.5.1 on MacOS 12.0.1:

:WikiJournalToWeek/Month are not pulling any journals for me. The generated title is the default title (ignoring init.vim). Then follows the rest of any matched template (unfortunately) - but no journals. I've tried commenting out my wiki_template section entirely in init.vim, and then I just get the default title, period - but, again, no journals. The wiki root is ~/Notes and the journals are in ~/Notes/journal of the form YYYY-MM-DD.md. Maybe I'm just missing something fundamental?

Relevant section of init.vim:

" Wiki Export
let g:wiki_export = {
        \ 'args' : '--pdf-engine=xelatex',
        \ 'from_format' : 'markdown',
        \ 'ext' : 'pdf',
        \ 'link_ext_replace': v:false,
        \ 'view' : v:true,
        \ 'viewer' : 'open',
        \ 'output': fnamemodify(tempname(), ':h'),
        \}

" Markdown Wiki.vim
let g:wiki_root = '~/Notes'
let g:wiki_filetypes = ['md']
let g:wiki_link_extension = '.md'
let g:wiki_write_on_nav = 1
let s:tag_parser = deepcopy(g:wiki#tags#default_parser)
let s:tag_parser.re_match = '\v%(^|\s)#\zs[^# ]+'
let s:tag_parser.re_findstart = '\v%(^|\s)#\zs[^# ]+'
let s:tag_parser.make = {t, l -> empty(t) ? '' : join(map(t, "#" . v:val))}
let g:wiki_tag_parsers = [s:tag_parser]
let g:wiki_toc_title = 'Contents'
let g:wiki_template_title_week = '# Summary Week %(week), %(year)'
let g:wiki_template_title_month = '# Summary for %(month-name) %(year)'

" Wiki.vim Templates
let g:wiki_templates = [
          \ { 'match_re': '202',
          \   'source_filename': '/Users/donnie/Notes/templates/daily-vim.md'},
          \ { 'match_re': 'Quote',
          \   'source_filename': '/Users/donnie/Notes/templates/quote-vim.md'},
          \ { 'match_re': 'Project',
          \   'source_filename': '/Users/donnie/Notes/templates/project-vim.md'},
          \ { 'match_re': '',
          \   'source_filename': '/Users/donnie/Notes/templates/atomic-vim.md'},
          \]

" Enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" IMPORTANT: :help Ncm2PopupOpen for more information
"set completeopt=noinsert,menuone,noselect
" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Wiki Link Completion with ncm2
augroup my_cm_setup
    autocmd!
    autocmd BufEnter * call ncm2#enable_for_buffer()
    autocmd User WikiBufferInitialized call ncm2#register_source({
          \ 'name': 'markdown',
          \ 'priority': 9,
          \ 'scope': ['markdown'],
          \ 'word_pattern': '\w+',
          \ 'complete_pattern': '\[\[',
          \ 'on_complete': ['ncm2#on_complete#delay', 200,
          \                 'ncm2#on_complete#omni',
          \                 'wiki#complete#omnicomplete'],
          \})
  augroup END
lervag commented 2 years ago

Thank you for this very useful plugin.

Glad you like it!

:WikiJournalToWeek/Month are not pulling any journals for me. The generated title is the default title (ignoring init.vim). Then follows the rest of any matched template (unfortunately) - but no journals. I've tried commenting out my wiki_template section entirely in init.vim, and then I just get the default title, period - but, again, no journals. The wiki root is ~/Notes and the journals are in ~/Notes/journal of the form YYYY-MM-DD.md. Maybe I'm just missing something fundamental?

Good question. To be honest, I've implemented this feature to fit my own style, and it does not really allow much flexibility. Notice the following text in the docs of :help wiki-templates-journal-summaries:

The parsed results typically need manual editing, and it currently only works
for a very specific format of journals.

I didn't even explain the format. So here it is; my journal entries look like this:

<One or two tables for specifying hours per project>

Category
* List based summary
* With perhaps
  * sub lists

Another category
* List based summary
* With perhaps
  * sub lists

A third category
* Link to [[#Specific note ...]]

# Specific note (e.g. meeting note or similar)

# Another specific note

When I create a weekly summary, the template will combine the category lists chronologically, then I manually summarize them. The categories are usually project related.

I'm not sure if this explains your issue directly, but my point is that I did not really implement this for "most people". I believe instead a way forward here would be for wiki.vim to provide a method for creating these templates and then I could move the "me" specific code into my own customization. E.g.:

I propose to allow a user function for aggregating the daily entries. The default could be to simply include the entire daily entries; or this could be a built-in aggregator that a user could choose to apply.

lervag commented 2 years ago

One question here is how useful this feature would be. I think it would be a non-trivial effort, and my personal gain of doing it is not very large as the current behaviour already meets my own needs. But if making changes here to allow users a desired amount of flexibility is interesting and would be useful to more people, then I guess it could be worth the effort.

donniep commented 2 years ago

In the spirit of 'one thing well' I think it would be very fair to leave as is and perhaps clarify the use case.

lervag commented 2 years ago

Thanks for the feedback. I don't have much time lately, but I'll think about this and at least improve the related docs to clarify.

lervag commented 2 years ago

Sorry for the delay in an update here. I've updated the docs and will leave it at that for now. If anyone feels strongly that I should allow a more general purpose summary generator, then I will consider it again.