Friday, June 24, 2011

Re: Aw: Re: Conditionally generated templates

----- "lith" wrote:

> 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:

Interesting. This is really neat.
I doubt I can add the <before/> and <after/> sections, but it gave me an idea to simplify the syntax about expanding variables from the placeholders.

> <tskel:before>
> let s:filename = expand('%:p')

With mu-template, I had to add a hook in order to load project-specific settings (defined with plugins like local_vimrc) before the newbuffer event is trigerred. The typical application is to define project root-directory, to deduce header guards in C/C++, or the base class name in OP's case.

Out of curiosity, does tskeleton support template-file inclusions ? Because of the before/after sections, I'd say no -- as they imply some complexity if we want to support things like a switch-snippet that loads the case-snippet for every value from an enumeration. (that's not impossible, but that requires a lot of context pushes&pops)

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--
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:

Post a Comment