如何更改 Sublime Text 3 中的默认代码片段? [英] How to change default code snippets in Sublime Text 3?

查看:65
本文介绍了如何更改 Sublime Text 3 中的默认代码片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何自己编辑片段,只是在新版本的 Sublime Text 中似乎无法找到默认的片段.

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.

编辑:我试图找到并因此编辑的代码段是 Latex 文件的默认值,特别是从以下内容转换的:

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

\section{section name} % (fold)
\label{sec:section_name}

推荐答案

Sublime Text 3 将其包存储在 .sublime-package zip 文件中(位置因操作系统而异),因此与 ST2 不同,您可以不只是转到 Packages 文件夹并查看所有内容.但是,有一个名为 PackageResourceViewer 的优秀插件(可通过 Package Control) 可以将文件或整个包提取到 Packages 目录中.

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.

安装插件后:

  • 点击CtrlShiftP打开命令面板
  • 输入 prv 以获取 Package R 资源V浏览器: 选项
  • 选择包资源查看器:打开资源
  • 在列表中向下导航到 LaTeX
  • 然后打开 section-..-(section).sublime-snippet 文件.
  • 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.

您现在应该可以编辑此文件并保存它,这将创建一个可以直接打开的新文件 Packages/LaTeX/section-..-(section).sublime-snippet如果您需要再次更改它,请通过文件菜单.

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.

如果您想处理多个文件或整个包,请使用 Package Resource Viewer: Extract Package 它将所有内容解压缩到 Packages/PackageName 文件夹中.但是请记住,一旦包或单个文件被提取到 Packages 文件夹中,它们就会覆盖位于 .sublime-package 存档中的同名文件.这有利于自定义,但如果在某个时候更新了父包,您将看不到效果,因为它们被 Packages 中的内容屏蔽了.因此,最好仅提取您需要的内容,并密切关注您的软件包更新,以防引入了您想要利用的新功能.

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.

祝你好运!

这篇关于如何更改 Sublime Text 3 中的默认代码片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆