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

Add %random variable for template files #112

Open
drkmrin78 opened this issue Aug 16, 2021 · 1 comment
Open

Add %random variable for template files #112

drkmrin78 opened this issue Aug 16, 2021 · 1 comment

Comments

@drkmrin78
Copy link

I think it would be useful to make templates that match the front_matter of other tools, for easier collaboration and integration into other zettelkasten tools. For this, some tools create unique random IDs in the front matter.

similar to #68

Thanks!

@michal-h21
Copy link
Owner

Do you mean the similar string as used in %random template for filenames, or just some random number? You can add custom fields to the front_matter, where values can be filled by Vim functions. For example, this configuration can be used to insert a random number in Vim 8.2:

function! s:insert_random()
  let seed = srand()
  return rand(seed)
endfunction
    
let g:zettel_options = [ {"front_matter" : [["random", function("s:insert_random")]]}]

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