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: 687
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: Edit pre-existing snippets?

Postby rudiedirkx on Sat Sep 20, 2014 9:38 pm

I realize I'm a year late, but this is what I did:

I wanted to change the function completion of get_defined_vars(), because it adds "oid" as argument, and I never want that.

1. I copied and renamed PHP.sublime-package to zip and opened it
2. Looked for get_defined_vars inside the files
3. Found file PHP.sublime-completions
4. Used PackageResourceViewer to edit that file
5. Save file
6. Delete that copied renamed ZIP file

PackageResourceViewer makes sure everything is saved correctly. My new fav package.
rudiedirkx
 
Posts: 5
Joined: Wed May 07, 2014 3:45 pm

Re: ST3: Edit pre-existing snippets?

Postby shtewps on Sat Nov 15, 2014 12:51 am

Image

Then "save as" and place in your Packages/User folder as to maintain your changes through any updates.
shtewps
 
Posts: 1
Joined: Wed Sep 17, 2014 10:32 pm


Return to Technical Support

Who is online

Users browsing this forum: Majestic-12 [Bot] and 20 guests