{"action":"created","issue":{"url":"https://api.github.com/repos/vimwiki/vimwiki/issues/125","labels_url":"https://api.github.com/repos/vimwiki/vimwiki/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/vimwiki/vimwiki/issues/125/comments","events_url":"https://api.github.com/repos/vimwiki/vimwiki/issues/125/events","html_url":"https://github.com/vimwiki/vimwiki/issues/125","id":66273061,"number":125,"title":"how do I change diary wiki files extention to \".diary.wiki\" ?","user":{"login":"linuxcaffe","id":2353531,"avatar_url":"https://avatars.githubusercontent.com/u/2353531?v=3","gravatar_id":"","url":"https://api.github.com/users/linuxcaffe","html_url":"https://github.com/linuxcaffe","followers_url":"https://api.github.com/users/linuxcaffe/followers","following_url":"https://api.github.com/users/linuxcaffe/following{/other_user}","gists_url":"https://api.github.com/users/linuxcaffe/gists{/gist_id}","starred_url":"https://api.github.com/users/linuxcaffe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linuxcaffe/subscriptions","organizations_url":"https://api.github.com/users/linuxcaffe/orgs","repos_url":"https://api.github.com/users/linuxcaffe/repos","events_url":"https://api.github.com/users/linuxcaffe/events{/privacy}","received_events_url":"https://api.github.com/users/linuxcaffe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-04T04:21:44Z","updated_at":"2015-04-06T01:15:15Z","closed_at":null,"body":"I've recently started using vim-template (https://github.com/aperezdc/vim-template) and I'd like to have my diary files opened with a diary template. In order for this to happen automatically, changing the default extension from \".wiki\" to \".diary.wiki\" would do the trick, but I haven't been able to figure that out.. clues please?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vimwiki/vimwiki/issues/comments/89878063","html_url":"https://github.com/vimwiki/vimwiki/issues/125#issuecomment-89878063","issue_url":"https://api.github.com/repos/vimwiki/vimwiki/issues/125","id":89878063,"user":{"login":"volker-fr","id":4174391,"avatar_url":"https://avatars.githubusercontent.com/u/4174391?v=3","gravatar_id":"","url":"https://api.github.com/users/volker-fr","html_url":"https://github.com/volker-fr","followers_url":"https://api.github.com/users/volker-fr/followers","following_url":"https://api.github.com/users/volker-fr/following{/other_user}","gists_url":"https://api.github.com/users/volker-fr/gists{/gist_id}","starred_url":"https://api.github.com/users/volker-fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volker-fr/subscriptions","organizations_url":"https://api.github.com/users/volker-fr/orgs","repos_url":"https://api.github.com/users/volker-fr/repos","events_url":"https://api.github.com/users/volker-fr/events{/privacy}","received_events_url":"https://api.github.com/users/volker-fr/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T01:15:15Z","updated_at":"2015-04-06T01:15:15Z","body":"I can't tell you if the extension can be changed just for the diary (I don't remember such an option), but I can share you my self-hacked solution and a potential way to do it without a workaround (like I use it).\r\n\r\nYou might be able to load the template based on something like\r\n```\r\nautocmd BufNewFile */diary/????-??-??.wiki call templateplugin#function('variable')\r\n```\r\n\r\n\r\n\r\nThe following is an over time grown solution that works for me. I didn't find a template framework at that time that fit my needs. Maybe it is interesting for someone.  I have to admit that there are probably multiple ways to improve it. Please be aware that I use .md files and not .wiki files, so you might need to adjust this.\r\n\r\n```vim\r\nautocmd BufNewFile */diary/????-??-??.md call s:new_vimwiki_diary_template()\r\n\r\n[...]\r\n\r\nfunction s:new_vimwiki_diary_template()\r\n  \" load diary template\r\n  read ~/repos/vimwiki/templates/diary.tpl | execute \"normal ggdd\"\r\n  \" execute VIM_EVAL tag\r\n  %substitute#\\[:VIM_EVAL:\\]\\(.\\{-\\}\\)\\[:END_EVAL:\\]#\\=eval(submatch(1))#ge\r\n  let dow = strftime(\"%a\") \" day of week\r\n  let dom = strftime(\"%e\") \" day of month\r\n  \" ==# is case insensitive\r\n  \" bi-weekly\r\n  if (dow ==# \"Sat\") || (dow ==# \"Wed\")\r\n     %substitute#%bi-weekly%#\r\n  end\r\n  \" weekly\r\n  if (dow ==# \"Sat\")\r\n     %substitute#%weekly%#\r\n  endif\r\n  \" monthly\r\n  if (dow ==# \"Sat\") && ((dom < 7))\r\n     %substitute#%monthly%#\r\n  endif\r\n  \" bi-monthly\r\n  if (dow ==# \"Sat\") && ((dom < 7) || (dom > 23))\r\n     %substitute#%bi-monthly%#\r\n  endif\r\n  \" cut all other lines starting with '%' out\r\n  execute \"g/^%/d\"\r\nendfunction\r\n```\r\n\r\nThe template itself looks as following:\r\n```\r\n# [:VIM_EVAL:]strftime('%Y-%m-%d')[:END_EVAL:] #\r\n\r\n%bi-weekly%* [ ] bi-weekly task entry\r\n%bi-monthly%* [ ] bi-monthly task entry\r\n%monthly%* [ ] monthly task entry\r\n%weekly%* [ ] weekly task entry\r\n%any other commented out line\r\n```\r\n"}}