I was switching to vim for the C-support mode, and then I discover yasnippet for emacs, it is awesome I love it !
So now I'm adding basic snippets to insert code and I am currently having a bit of difficulties to make a good for ( ...; ...; ... ) snippet.
I can do this : for ( $1; $2; $3 )
But I would like to have some defaults values, or else benefit from the mirror functionality of yast.
I know I can set default values with ${$1value} but in my case I think need to imbricate them, I haven't succeed trying it. I ewplain what I'd like : By default, I should be for ( int i = 0; i < $something; i++ )
With the possibility to modify the int type (could be nothing), the variable name, which I want to mirror in the second and third part, and the affectation.
The condition could also be different, but it needs to contain the first variable, same for incrementation. Is it possible ?
It might be a better idea to keep it simple and define more snippets, I wonder if some of you have results with complex snippets.