How to make Sublime Text 3 default templates

2020-07-20 03:33发布

问题:

In Sublime Text 3, when I create a new file (HTML, JavaScript, PHP, etc), is there a way to edit the default tags and their indentations? Currently, when I create a new file, say HTML, I get:

<html>
<head>
  <title></title>
</head>
<body>
</body>
</html>

I would like to change it so that a new HTML file creates:

<html>
  <head>
    <title></title>
  </head>

  <body>
  </body>
</html>

Is this possible without plugins or will I have to search for/make one?

回答1:

You can change the default snippet with the PackageResourceViewer plugin.

  • Install PackageResourceViewer through Package Control
  • Press Ctrl+Shift+P and type prv
  • Select PackageResourceViewer: Open Resource
  • Type html and select it.
  • Select html.sublime-snippet