Home Download Buy Blog Forum Support

The correct way to use built in snippets?

The correct way to use built in snippets?

Postby ausprog on Tue Jan 29, 2013 12:11 pm

Hey,
So i love being able to TAB a trigger (for instance html:TAB, h1:TAB, li:TAB etc) to expand the html.

However, if I'm in a PHP doc, this functionality rarely ever triggers, yet I watch other videos, and sometimes at random for myself it will trigger and work correctly.

I even use Shft+Ctrl+P: Syntax html (in the php document) to try and force a syntax change (in the hope that triggers will change) but it just keeps the syntax as PHP.

Is there a way to globally allow default tab triggers? I've found that if there's been an overlap (multiple triggers registered) it will just show a dropdown to choose the correct one.

Obviusly if i need to add any html elemtent to any document that isn't an HTML doc, i then have to add it all manually. I'm still learning ST2's ins and outs, but this is my biggest gripe, and If someone can set me on the right path here I'll be a very happy man.
ausprog
 
Posts: 13
Joined: Sun Oct 14, 2012 7:58 am

Re: The correct way to use built in snippets?

Postby britalb on Thu Jan 31, 2013 1:31 am

Save your file with a .php extension, use Shift+Ctrl+P, and type "snippet" to see which snippets are available. If you'd like more, you can add a third-party library, like "sublime-phpsnippets."

If you haven't installed package control, you might want to do that first:
http://wbond.net/sublime_packages/package_control

Based on your question, you might find this free & excellent tutorial series useful:
https://tutsplus.com/course/improve-wor ... me-text-2/
britalb
 
Posts: 2
Joined: Thu Jan 31, 2013 12:31 am

Re: The correct way to use built in snippets?

Postby ausprog on Thu Jan 31, 2013 1:07 pm

britalb wrote:Save your file with a .php extension, use Shift+Ctrl+P, and type "snippet" to see which snippets are available. If you'd like more, you can add a third-party library, like "sublime-phpsnippets."

If you haven't installed package control, you might want to do that first:
http://wbond.net/sublime_packages/package_control

Based on your question, you might find this free & excellent tutorial series useful:
https://tutsplus.com/course/improve-wor ... me-text-2/


Thanks for the reply :D

I've worked my way through Jeff's ST2 course, and have package control installed; installing additional snippets seemed to have helped, though my main issue was simply accessing other language snippets (for instance html snippets) from within a php document, and when 'trying' to change the syntax (wouldn't switch, i assume due to the file name being .php, which is a shame and seemingly a lack of control) it would still fail.

I followed your recommendation, but installed HTML snippets instead and that seems to have allowed me to run html snippets in .php documents again (though i could initially do this by default without plugins, so I'm quite incertain why there are inconsistencies). Anyway, from here I imagine I just have to make my own snippets or install additional ones.
ausprog
 
Posts: 13
Joined: Sun Oct 14, 2012 7:58 am


Return to General Discussion

Who is online

Users browsing this forum: BestGreek, Google [Bot] and 39 guests