michal-h21 / vim-zettel

VimWiki addon for managing notes according to Zettelkasten method
MIT License
557 stars 74 forks source link

Add option to Name Zettel Note filename by title #16

Closed ecks closed 4 years ago

ecks commented 4 years ago

Hello,

Thank you for developing this plugin. Would you be interested in considering my modification? It allows the filename to be appended with the title, and if there is no title passed it won't append it. It is just easier for me when I am searching my notes to give me more context into what the note was for.

If you would be interested in this modification, I can fine-tune it and add a global variable so this behaviour is user-set through a config variable.

Let me know your thoughts,

michal-h21 commented 4 years ago

Hi Hristo, thanks for this. I think it would be nice if it could be configurable, global variable sounds nice.

ecks commented 4 years ago

Hey Michal,

I made a change to the PR, where it is controlled through global toggle. Could you take a look?

michal-h21 commented 4 years ago

Hi Hristo, I've changed your code slightly. Instead of a global variable, I've added a new formatting strings to the g:zettel_format variable. %title will insert the sanitized title - it is lower cased, spaces replaced with underscored and dangerous characters escaped using fnameescape function. %raw_title inserts exact title that was used in :ZettelNew. The configuration can look like this:

 let g:zettel_format = "%y%m%d-%H%M-%title" 
ecks commented 4 years ago

thanks!

michal-h21 commented 4 years ago

I've added few new variable templates. I wanted to do this for quite some time, so thanks for the impulse! :)