-
Move to the folder where the installed packages reside, i.e.
/Applications/Sublime Text.app/Contents/MacOS/Packages
. You can hop there either by typing:cd /Applications/Sublime Text.app/Contents/MacOS/Packages
or from the Application folder: right click on Sublime Text -> Show Package Contents -> Contents -> MacOS -> Packages -
Identify the target file. E.g. i want to change the default behavior of the for loop snippet of C/C++ because i find
++i
in place ofi++
hella annoying. With that in mind you can move on to -
select the responsible package
C++.sublime-package
and duplicate it -
rename the just duplicated file by adding
.zip
. The file will now appear as a proper zipped file. -
unzip it
-
move to the folder Snippets inside the just unzipped folder
-
identify the file of interest, in the above mentioned case it's named
030-for-int-loop-(fori).sublime-snippet
-
edit the file according to your taste and save it.
-
go back to the "root" folder where all the packages reside, see (1)
-
(optional) move or clone the original file
C++.sublime-package
somewhere secure, just for a quick sort-of backup -
delete the
.zip
file previously created -
delete the file
C++.sublime-package
-
compress the folder that we just edited (in my case called
C++.sublime-package 2
) -
rename it to
C++.sublime-package
-
delete the unzipped folder (in my case called
C++.sublime-package 2
) -
leave a star to this GitHub Gist
If you just need to add a new snippet you can simply use the tool that Sublime provides. From the menu bar: Tools -> Developer -> New Snippet...
Save it with extension .sublime-snippet
in the suggested folder (should be under Packages -> User) and you're good to go.