qqzsxyz / vimwiki

Automatically exported from code.google.com/p/vimwiki
0 stars 0 forks source link

templates for creation of new pages #235

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. enter a WikiWord in some page
2. click it
3. see an empty page :)

I think a way to make usage of VimWiki smoother in some scenarios would be to 
have per-wiki copy templates for new pages. For example I use one vimwiki for 
issues which allways have the same structure. Another one is linked with 
Trunknotes on my iPhone, where I would like to have some minimal metadata tags 
in the start for new pages (mainly the Tags: line). Maybe some per-wiki setting 
"template" that points to one page of the Wiki that is copied to new pages on 
creation would allready do it.

Original issue reported on code.google.com by glba...@gmail.com on 26 Jul 2011 at 3:11

GoogleCodeExporter commented 9 years ago
hmm, sorry, don't use google issues that often, would have liked to make this a 
different type - it's more useability or wishlist.

Original comment by glba...@gmail.com on 26 Jul 2011 at 3:12

GoogleCodeExporter commented 9 years ago
This is not vimwiki's job.

try https://github.com/hotoo/template.vim

Original comment by HoToo.cn on 16 Aug 2011 at 3:42

GoogleCodeExporter commented 9 years ago
That's not exactly the same - template.vim is cool, but it only associates 
templates with file extensions, but for example wouldn't know about different 
wikis. The way I see it, it would make much more sense to have a template 
option on wikis so that when you create a new page, that template is taken - 
but only inside this wiki.

Original comment by glba...@gmail.com on 16 Aug 2011 at 4:00

GoogleCodeExporter commented 9 years ago
You can have different file extensions for different wikis

Original comment by m...@zmlka.com on 16 Aug 2011 at 5:55

GoogleCodeExporter commented 9 years ago
I found that creating a template using snipmate was an easy solution, and more 
flexible than template.vim.

For example, to insert TrunkNotes style metadata at the top of a wiki page, I 
created a snippet called `tnhdr` in my `snippets/vimwiki.snippets` file.

{{{ text
snippet tnhdr
    Title: ${1}
    Timestamp: `strftime("%F %T")` +0000
    Created: `strftime("%F %T")` +0000
    Last Accessed: `strftime("%F %T")` +0000
    Times Accessed: 1
    Tags: 
    Metadata: 

}}}

Note that lines start with tab-chars, and that I am using the system command 
strftime available on my mac.

To quickly insert this snippet, I added the following mapping to my .vimrc: 

  au FileType vimwiki nmap <Leader>wl ggitnhdr<c-r>=TriggerSnippet()<cr><Esc>

Original comment by stu.andrews on 18 Aug 2011 at 5:45

GoogleCodeExporter commented 9 years ago

Original comment by habamax on 20 Aug 2011 at 4:34

GoogleCodeExporter commented 9 years ago
I would suggest to use existing template plugins for that purpose. 

Don't forget that you can set up different extensions to your wikies, thus 
template.vim would be able to differetiate them.

Original comment by habamax on 14 May 2012 at 5:45