Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
CSS: source.css
D: source.d
Diff: source.diff
Erlang: source.erlang
Go: source.go
GraphViz: source.dot
Groovy: source.groovy
Haskell: source.haskell
HTML: text.html(.basic)
JSP: text.html.jsp
Java: source.java
Java Properties: source.java-props
Java Doc: text.html.javadoc
JSON: source.json
Javascript: source.js
BibTex: source.bibtex
Latex Log: text.log.latex
Latex Memoir: text.tex.latex.memoir
Latex: text.tex.latex
LESS: source.css.less
TeX: text.tex
Lisp: source.lisp
Lua: source.lua
MakeFile: source.makefile
Markdown: text.html.markdown
Multi Markdown: text.html.markdown.multimarkdown
Matlab: source.matlab
Objective-C: source.objc
Objective-C++: source.objc++
OCaml campl4: source.camlp4.ocaml
OCaml: source.ocaml
OCamllex: source.ocamllex
Perl: source.perl
PHP: source.php
Regular Expression(python): source.regexp.python
Python: source.python
R Console: source.r-console
R: source.r
Ruby on Rails: source.ruby.rails
Ruby HAML: text.haml
SQL(Ruby): source.sql.ruby
Regular Expression: source.regexp
RestructuredText: text.restructuredtext
Ruby: source.ruby
SASS: source.sass
Scala: source.scala
Shell Script: source.shell
SQL: source.sql
Stylus: source.stylus
TCL: source.tcl
HTML(TCL): text.html.tcl
Plain text: text.plain
Textile: text.html.textile
XML: text.xml
XSL: text.xml.xsl
YAML: source.yaml

Thank you very much, very handy!

This is awesome; exactly what I was looking for to help me make better, more targeted snippets :)

GuigZ- commented Jul 30, 2013

TPL : text.html

I seek the better syntax ... if you have :)

Is it possible to get scope for files without any extensions?

There is one more that may be handy when making color schemes - text.find-in-files, it's the one that is set to the find in files outputs.

Thank a lot for this, also I know there are very few people who uses PL/SQL on Sublime (way better than Jdeveloper), but there should be "maybe" someone just like me that uses Sublime for Anything and Everything; So there is this plugin called Oracle PL/SQL that will give you some sintax recognition. I had a good pair of snippets and the Scope for the developers that may want to check it out will be:

source.plsql

Hope this results useful for someone.

I know there is sass in there, but could you add in scss: source.scss for reference as well?

Nice list, mate!

vace commented Apr 20, 2014

thank you!

I was struggling with the scope in a snippet and just found this. Thank you!

Awesome!, thanks

hite commented Aug 6, 2014

FreeMarker or ftl : text.html.ftl

Very handy!

Thanks.

wzup commented Feb 19, 2015

Twig?
There is HTML(Twig) syntax that Twig plugin provides. What is the scope for it?

Thank You!

Really helpful ! Thanks !

PostgreSQL - scope.pgsql

M4urice commented May 5, 2015

Is there a scope for new files? (I want to trigger a snippet even before I save a new file)

Prolog- source.prolog.

Nice! Super useful

Eomerx commented Jun 12, 2015

great gist, thank you very much.
btw, source.css.less doesn't work for me.
used source.less

Perfect man ... tanks a lot

wonzbak commented Jul 7, 2015

thanks,

Can you add Twig: text.html.twig

projer commented Jul 24, 2015

Thanks for the list!

yuntas commented Sep 7, 2015

Thanks, Mr. @iambibhas.

By the way, How did you know that ?

I wanna make a snippet related to ".Rmd", but there is no your list.

Therefore, I can't use my custom snippet...

Thanks for the list,

is it possible to add TypeScript and React support?

.ts, .jsx, .tsx

Thanks a lot!!!

skube commented Dec 16, 2015

This is great. 👍

Also keep in mind you can always check and see (in the status bar) the current scope:

  • Ctrl + Alt + p (Windows and Linux)
  • Command + Option + p (OS X)

Thanks you very much

How might you be able to have php.scope and have a snippet complete the entire . I opened a php file and hit the Cmd + Option + p and get "embedding.php" but the mini autocomplete popup won't show this source. Any ideas?? Awesome list by the way!!

@awakekat - I could be wrong but it looks like you are using Advanced Custom Fields. If so, this will be helpful, https://github.com/smilledge/acf-sublime-snippets

Thank You!

Thanks you 😄

Thanks you 😄

iahu commented Mar 28, 2016

very useful list

For those who are asking about having the snippets work for all files or for files that have not been saved yet, just leave out the scope, it's optional anyway, and it'll work for all files.

fro commented Apr 21, 2016

Thank you, this is so useful.

Thanks for the list.

@PacmanBits, use source.js.jsx for .jsx

I also found that Shift+Ctrl+Alt+P command really shows the current scope under the cursor. Very convenient.

There are $ symbol how to solve?

jwt625 commented Feb 5, 2017

Thanks, very useful!

raj015 commented Apr 15, 2017

how to add scope for multiple file types

How can we extend the valid scope list? I'd particularly like to see .txt and .md added. Can I add my own custom scopes somehow?

fhightower commented Jul 23, 2017 edited

Assembly: source.assembly

what's the javascript es6 scope?
image

If you don't give any scope, Then it will run globally means everywhere you can use particular snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment