Create a gist now

Instantly share code, notes, and snippets.

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
@vlakarados

Thank you very much, very handy!

@blindside85

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

@GuigZ-
GuigZ- commented Jul 30, 2013

TPL : text.html

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

@chaitan94

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

@vlakarados

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.

@Esteban-Rocha

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.

@jackcutting

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

@yang-wei

Nice list, mate!

@vace
vace commented Apr 20, 2014

thank you!

@objectivegeek

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

@austinicomedez

Awesome!, thanks

@hite
hite commented Aug 6, 2014

FreeMarker or ftl : text.html.ftl

@benbrowning

Very handy!

@xinshangshangxin

thanks

@lijin305

Thanks.

@wzup
wzup commented Feb 19, 2015

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

@jdsantiagojr

Thank You!

@raven-chen

Really helpful ! Thanks !

@JoaoFranciscoNeto

PostgreSQL - scope.pgsql

@M4urice
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)

@webglider

Prolog- source.prolog.

@dvogeldev

Nice! Super useful

@Eomerx
Eomerx commented Jun 12, 2015

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

@tadeobarranco

Perfect man ... tanks a lot

@wonzbak
wonzbak commented Jul 7, 2015

thanks,

Can you add Twig: text.html.twig

@projer
projer commented Jul 24, 2015

Thanks for the list!

@yuntas
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...

@PacmanBits

Thanks for the list,

is it possible to add TypeScript and React support?

.ts, .jsx, .tsx

@fjmarcelo

Thanks a lot!!!

@skube
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)
@kingRayhan

Thanks you very much

@awakekat

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!!

@GarySwift

@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

@IgorGavrilenko

Thank You!

@kingRayhan

Thanks you 😄

@chenshengzhi

Thanks you 😄

@iahu
iahu commented Mar 28, 2016

very useful list

@jamiecalder

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
fro commented Apr 21, 2016

Thank you, this is so useful.

@prabhath6

Thanks for the list.

@victorpolko

@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.

@Alien3389

There are $ symbol how to solve?

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