问题
I have a snippet that does not fire on the tab trigger. Here's my code...
<snippet>
<content><![CDATA[
.contentBox ul{list-style: none; padding: 0;}
.contentBox ul li{padding-left: 2.5em; text-indent: -0.7em; margin-bottom: 4px;}
.contentBox ul li:before{content: "${1:•} "; color: #${2:Bullet color};}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>xcv</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.css</scope> -->
</snippet>
If I'm on an HTML file, the tab trigger (xcv) works. However, on a CSS file, it doesn't work. BUT if I select the snippet through CTRL+SHIFT+P, it will output the code. Also on CSS files, if I try the tab trigger within a selector, it will work.
I've tried setting the scope to source.css and text.css (as well as guiding it out), and none make a difference. I've also restarted Sublime.
Any ideas?
回答1:
I have same issue with you and I had found a resolution to solve it.
I had read it at: Unknown CSS Tab Completion in Sublime Text
To fixed it:
Your code: <tabTrigger>sep</tabTrigger>
Exact code to it work: <tabTrigger>sep/</tabTrigger>
Hope it helpful for you
回答2:
I had this problem for some time, and couldn't find any solution anywhere, and sure it works by putting a / behind the trigger, but what makes it not working in the first place ?
I think the answer here is emmet, and i fixed this by simply writing my trigger and instead of pressing the tab button, i press ctrl+space, and that somehow works for me, but i don't know why.
Hope this helps someone out there :)
回答3:
To solve this problem, use the following tags and then restart Sublime.
<tabTrigger>css3</tabTrigger><br>
<scope>source.css</scope>
来源:https://stackoverflow.com/questions/25629441/sublime-text-3-snippet-doesnt-fire-on-tab-only-on-css-file