Home Download Buy Blog Forum Support

ST3: Edit pre-existing snippets?

ST3: Edit pre-existing snippets?

Postby fbeaton on Tue Jul 02, 2013 9:20 pm

Hi!

I apologize if this has already been addressed, but I'd like to edit the existing snippets for PHP. Specifically, to change the bracket style to match the house-style my dev team uses (opening bracket on newline). This was fairly easy to do in ST2, but I can't figure out how to do this in ST3, since there's no clearly named PHP definition file in the Application Support/Sublime Text 3/ directory in OS-X.

Any help would be greatly appreciated.

Thanks (and I love the product)!

F
fbeaton
 
Posts: 3
Joined: Tue Jul 02, 2013 9:14 pm

Re: ST3: Edit pre-existing snippets?

Postby riddler12 on Tue Jul 02, 2013 10:31 pm

Hello!

Snippets for languages are now contained in the app itself so if you head on over to

Code: Select all
/Applications/Sublime Text.app/Contents/MacOS/Packages


you will see several files and the file you are looking for is "PHP.sublime-package". sublime-packages are just zip files so what I tend to do is rename them with a .zip extension and double click to open and extract and the file you are looking for will be in there.
riddler12
 
Posts: 12
Joined: Sun Jun 09, 2013 1:42 pm

Re: ST3: Edit pre-existing snippets?

Postby fbeaton on Tue Jul 02, 2013 10:39 pm

Perfect, thanks!

F
fbeaton
 
Posts: 3
Joined: Tue Jul 02, 2013 9:14 pm

Re: ST3: Edit pre-existing snippets?

Postby fbeaton on Fri Jul 12, 2013 12:48 am

Finally had time to edit the snippets, but doing so caused problems.

For the record, I went into /Applications/Sublime Text.app/Contents/MacOS/Packages/, renamed the PHP package with a .zip extension, unpacked it, opened/edited the snippet files, then re-zipped the directory (using OS-X right-click->Compress), and renamed the zipfile, removing the .zip extension.

When I relaunched ST3, I got a ton of errors saying the language file could not be found, and the ApplySyntax package stopped working. Retried the procedure several times, and it never clicked.

Is there anything special I need to do re zip parameters, permissions, etc.? Seems like I must be missing a step.
fbeaton
 
Posts: 3
Joined: Tue Jul 02, 2013 9:14 pm

Re: ST3: Edit pre-existing snippets?

Postby skuroda on Fri Jul 12, 2013 2:48 am

You shouldn't have to package everything back up. In fact, that's probably the wrong way to go about it since it's possible for that to be overridden by future updates.

See Overriding Files From a Zipped Package at the following page. http://www.sublimetext.com/docs/3/packages.html

You may also want to take a look at PackageResourceViewer to help also.
skuroda
 
Posts: 677
Joined: Fri Oct 05, 2012 8:11 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 27 guests