Override default snippets in Atom
I am trying to override default snippets in Atom, because I want to change the default script snippet from
<script charset="utf-8"></script>
to
<script src=""></script>
I have put the following into snippets.cson.
'.text.html':
'Comment':
'prefix': 'com'
'body': '<!-- $1-->'
'Script':
'prefix': 'script'
'body': '<script src="$1"></script>'
My 'com' snippet works fine. But script results in the default snippet, not my new one.
Apparently its a bug right now.
via https://github.com/atom/atom/issues/2695
As of 1.19.5 I can override atoms default snippets by using the traditional procedure for creating snippets, which is written in coffeescript. For example, overwriting my require method looks something like . . .
'.source.[*yourlanguage*]':
'Require':
'prefix': 'r'
'body': "require '$1' "
More descriptively
Navigate to "snippets" via the file dropdown menu.
Follow the instructions listed, or continue with me.
Copy and paste the code I've provided above, below. Replace the yourlanguage with the language you are writing the code for you.
Open a new file, type the character following the 'prefix':, press tab.
This should give you enough information to contextually figure out how to both overwrite, and write original snippets.
上一篇: 色彩贴图始终以零为中心
下一篇: 在Atom中覆盖默认片段