Friday, June 24, 2011

Aw: Re: Conditionally generated templates

With mu-template, you'll need a template-file named ~/.vim/after/template/php.vim that contains

For comparison, here is Luc's template converted to tskeleton:

<tskel:before>
let s:filename = expand('%:p')
let s:parts=split(s:filename,'/')
let s:class=matchstr(s:parts[-1], '.*\ze\.')
let s:base=join(s:parts[0:-2],'_')
</tskel:before>
<tskel:after>
unlet s:filename s:parts s:class s:base
</tskel:after>
<?php class <+s:class:C+> extends <+s:base:C+> {
<++>
}

If you save it as "~/.vim/skeletons/bits/php/class", this will create a "class" skeleton/snippet. If you want to fill all php files with the above skeleton, save it as "~/.vim/skeletons/templates/php/php #.php".

Regards,
Tom

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: