问题
I am trying to make a snippet in Sublime Text 3 that only applies to CSS files. This is the snippet I have:
<snippet>
<content><![CDATA[/*
Theme Name: ${1:Theme name here and so on...}
Theme URI:
Author:
Author URI:
Description:
Version: 1.0.0
License:
License URI:
Text Domain:
Tags:
*/]]></content>
<tabTrigger>xyz</tabTrigger>
<scope>source.css</scope>
</snippet>
The problem is if I open a CSS file, type xyz
and hit tab all I will get is xyz: ;
. So it seems as if Sublime Text has already assigned the tab to insert : ;
instead of my snippet.
This problem does not occur if I remove the plugin package Emmet.
How can I get this snippet to work?
回答1:
The documentation at http://github.com/sergeche/emmet-sublime#tab-key-handler, suggests that it should be possible to get snippets to work in CSS files with Emmet enabled by adding the following preference in your Emmet preferences file:
"disabled_single_snippet_for_scopes": "source.css"
回答2:
Since you're already using Emmet, consider using an Emmet snippet instead.
{
"css": {
"filters": "css",
"profile": "css",
"snippets": {
"xyz": "/*\nTheme Name: ${1:Theme name here and so on...}\nTheme URI: \nAuthor: \nAuthor URI: \nDescription: \nVersion: 1.0.0\nLicense: \nLicense URI: \nText Domain: \nTags: \n*/"
}
}
}
来源:https://stackoverflow.com/questions/41181441/how-to-make-a-sublime-text-snippet-work-with-emmet-installed