Monday, April 1, 2013

sublime text 2 - snippet - print $this

 Hi everyone ..
I just to share my noobish discovery

 Print the  $this

in sublime text 2 to be used in snippet

Problem encounter : Earlier I tried to create a  snippet and I cant seem to make it work. $this doesn't seem cooperate .

My Noobish solution :



<snippet>
<content><![CDATA[
\$this
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>this</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>


so what ?
well you can you it like this


<snippet>
<content><![CDATA[
\$this->form_validation->set_rules('${1:fieldname}','${2:Fieldname}','${3:validation}');
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>setrule</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>

for codeigniter