15

I'm trying to define some snippets for editing Markdown, but I can't get them to trigger. I have tried using source.markdown, text.markdown and markdown as the scope, but none of them work. If I remove the scope constraint, the snippet works.

How do I figure out what scope to use?

2 Answers 2

32

To determine the current scope under your cursor, Ctrl+Alt+Shift+P on Windows and Linux does the trick, Ctrl+Shift+P on a Mac.

Alternatively, run the following in the Sublime console:

view.scope_name(view.sel()[0].begin())

To bring up the console on Windows, press Ctrl+'

3
2

The scope for Markdown is text.html.markdown. I think there are several packages that help you identify the current scope, ScopeAlways is one of them.

4
  • Nice, that worked! I'm confused though. If text.html.markdown works, shouldn't just markdown work too? I guess the scopes don't work the way I thought they did.
    – Hubro
    Commented Dec 5, 2014 at 8:20
  • ScopeAlways works flawlessly by the way, couldn't ask for more.
    – Hubro
    Commented Dec 5, 2014 at 8:22
  • 1
    The scope gets more specific with each appended child. Snippets in the scope text will work for all child scopes, e.g. text.html and text.html.markdown, but the latter will not work in any of its parents. You can also exclude certain child scopes, e.g. text.html -text.html.markdown.
    – idleberg
    Commented Dec 5, 2014 at 8:47
  • I thought it got more specific for each prepended child. Thanks for explaining :)
    – Hubro
    Commented Dec 5, 2014 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .