0

Every time I create a new Sublime Text 3 snippet, I make the same changes (in my case: replace "Hello, ${1:this} is a ${2:snippet}." with content that I have just copied from a file, delete the comments around the tabTrigger and the scope, set the scope to "text.html").

Is there a way to edit the template itself, so that this is all of this is already done (apart from pasting the copied content) when I create a new snippet?

James Newton
  • 5,667
  • 5
  • 41
  • 87
  • This question asks about Sublime text 3, but you should be able to use this answer that is about Sublime Text 2: http://stackoverflow.com/questions/16325001/how-to-edit-the-default-new-snippet-template-in-sublime-text-2 – Josiah Krutz Oct 10 '15 at 23:56

1 Answers1

0

If you're on Windows, see this question. If you're on a Mac:

  1. Open Terminal
  2. Enter unzip -j "/Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package" new_templates.py -d . into the terminal
  3. Enter "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" new_templates.py into the terminal
  4. Scroll down to bottom of new_templates.py inside Sublime, and make changes
  5. Save the file, close the tab, and quit sublime
  6. Enter zip "/Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package" new_templates.py into the terminal to reupdate the Default.sublime-package with your modified new_templates.py

Now if you reopen Sublime, go to the Tools menu, and click New Snippet..., you should be able to see your modified snippet!

With help from:
Extract only a specific file from a zipped archive to a given directory
How to update one file in a zip archive

Community
  • 1
  • 1
Josiah Krutz
  • 935
  • 6
  • 15