Is it possible to modify the HTML boilerplate shortcut? The “HTML + tab” shortcut to be exact. I have extra code I am always implementing into every project, and would love to streamline this by integrating it into the boilerplate shortcut.
Modify the HTML shortcut?
One possibility is to define your own snippet that is customized as you see fit, by selecting Tools > Developer > New Snippet...
and replacing the content with something like this:
<snippet>
<content><![CDATA[<!DOCTYPE html>
<html>
<head>
<title>$1</title>
<meta something="custom" />
</head>
<body>
$0
</body>
</html>]]></content>
<tabTrigger>html</tabTrigger>
<scope>text.html & (- meta.tag | punctuation.definition.tag.begin)</scope>
</snippet>
If you go this route you can keep the same tabTrigger
(html
) or alter it to something else. If you keep the same trigger, every time you invoke it you’ll be prompted to pick the one you want to use, whereas if you use a customized trigger it will Just Work .
Assuming you want to keep the html
trigger and literally just replace the existing snippet with a customized one, you can do that by installing PackageResourceViewer.
Once installed:
- Open the command palette
- Select the command
PackageResourceViewer: Open Resource
- Choose
HTML
- Choose
Snippets/
- Choose
html.sublime-snippet
Once you make any desired changes, save the file to automatically create an override that will replace the shipped version of the file with your custom version. From this point forward Sublime will only see your modified version of the file, so the html
snippet will expand out to your custom value.