Global scope for user snippet in Atom.io editor
Asked Answered
E

2

13

I would like to transform some snippets that I wrote for the Sublime Text 3 editor to the atom.io editor.

Since I have a "license" snippet that is valid for any type of file (any file extension) then in the licence.sublime-snippet file I did'n specify a scope:

<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->

Now, i see the above example in atom/snippets.

'.source.js':
  'console.log':
    'prefix': 'log'
    'body': 'console.log(${1:"crash"});$2'

The outermost keys are the selectors where this snippets should be active.

but I can't figure out how can I specify a global scope or better yet do not specify it at all as well as I did in .sublime-snippet. Any help is appreciated; in particular still have not found the comprehensive documentation of detailed operation snippet atom therefore also some links to this kind of docs are welcome.

Eltonelucidate answered 10/4, 2014 at 20:32 Comment(0)
B
24

Is this what you're looking for?

'*':
  'console.log':
    'prefix': 'log'
    'body': 'console.log(${1:"crash"});$2'
Burdensome answered 18/4, 2014 at 7:24 Comment(1)
What if I need two types of source for the same snippet? for example js and html.Joinder
S
2

@Basil Musa: For a snippet to be available in (js and html) files you specify it like this:

 '.html.js':
  'snippet-name':
    'snippet-shortcut': 'log'
    'snippet-body': 'console.log(${1:"placeholder"});$2'
Succulent answered 3/3, 2017 at 10:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.