Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
400 views
in Technique[技术] by (71.8m points)

sublimetext - How to change default code snippets in Sublime Text 3?

I know how to edit the snippets myself, just can't seem to be able to find the default ones in the new version of Sublime Text.

EDIT: The snippet I am trying to find and consequently edit is the default for the Latex files, in particular the one that converts from:

sec

to

section{section name} % (fold)
label{sec:section_name}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sublime Text 3 stores its packages in .sublime-package zip files (the location varies by OS), so unlike ST2 you can't just go to the Packages folder and see everything. However, there is an excellent plugin called PackageResourceViewer (available via Package Control) that can, among other things, extract files or whole packages to the Packages directory.

Once you've installed the plugin:

  • hit CtrlShiftP to open the command palette
  • type prv to get the Package Resource Viewer: options
  • select Package Resource Viewer: Open Resource
  • navigate down the list to LaTeX
  • then open the section-..-(section).sublime-snippet file.

You should now be able to edit this file and save it, which will create a new file Packages/LaTeX/section-..-(section).sublime-snippet that you can open directly via the file menu if you need to alter it again.

If you'd like to work on multiple files, or an entire package, use Package Resource Viewer: Extract Package which will unzip everything into the Packages/PackageName folder. Please keep in mind, though, that once packages or individual files are extracted into the Packages folder, they overrule files of the same name located in the .sublime-package archive. This is good for customization, but if at some point the parent package is updated, you won't see the effects because they're being masked by what's in Packages. Therefore, it's probably best to extract only what you need, and keep an eye on your package updates in case new features are introduced that you want to take advantage of.

Good luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...