[SVN] Re: Proposal for common snippet trigger naming

Mads Hartmann Jensen mads379 at gmail.com
Mon Feb 7 12:17:57 UTC 2011


> Don’t think we have tried to standardize these things, and it does annoy me that something as “universal” as class use different triggers in different languages: C++/Obj-C: ‘cl⇥’, Ruby: ‘cla⇥’, Python/PHP: ‘class⇥’.
> 
> To some degree ‘function’ is also fairly universal, although in some languages it would be unnatural to use f⇥/fun⇥ for a member function (method), and particularly ruby, anything but def⇥ would be less intuitive than the current def⇥.

This is why I think the keywords for the programming language would be a nice snippet triggers - People tend to remember the keywords ;) 

So a function would be:

Ruby: def⇥
scala: def⇥
Java: fun⇥
C: fun⇥

This ofc. means that to create a function you wont type the same characters in each bundle but at least you can 'guess' the keyword trigger on the fly. 

We can even make this backwards compatible by using the 'short-cut snippets' approach explained in the first mail:

C++/Obj-C:  ‘cl⇥’     => 'class⇥' => class snippet code  
Ruby:            ‘cla⇥’  => 'class⇥' => class snippet code 
Python/PHP:                   'class⇥' => class snippet code


More information about the textmate-dev mailing list