Skip to content

Documentation is lacking guidance for template usage #229

@pmatulis

Description

@pmatulis

For those unaccustomed to vimscript the usage of the templates feature is difficult to penetrate.

By looking at a past project issue I came up with the following:

let g:wiki_root = '~/data/sync/wiki'
let g:wiki_filetypes = ['md']
let g:wiki_link_extension = '.md'
let g:wiki_link_target_type = 'md'
let g:wiki_global_load = 0

let s:journal_template = g:wiki_root . '/.templates/journal.md'
let s:generic_template = g:wiki_root . '/.templates/generic.md'

let g:wiki_templates = [
      \ { 'match_re': '^\d\d\d\d-\d\d-\d\d$',
      \   'source_filename': s:journal_template},
      \ { 'match_func': {x -> v:true},
      \   'source_filename': s:generic_template}
      \]

The file ~/data/sync/wiki/.templates/journal.md exists and is deliberately simple at the moment:

# Heading one

## Todo

## Notes

However, doing the following does not use the template; the file (2022-06-22.md) comes up blank:

vim +WikiJournal

My ambitions are simple at this time. I want a journal file template that will produce file content like:

# Journal <date>

## Todo

## Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions