Instantly share code, notes, and snippets.

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

This comment has been minimized.

vlakarados commented May 3, 2013

Thank you very much, very handy!

@blindside85

This comment has been minimized.

blindside85 commented Jun 22, 2013

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

@GuigZ-

This comment has been minimized.

GuigZ- commented Jul 30, 2013

TPL : text.html

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

@chaitan94

This comment has been minimized.

chaitan94 commented Oct 16, 2013

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

@vlakarados

This comment has been minimized.

vlakarados commented Oct 19, 2013

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

This comment has been minimized.

Esteban-Rocha commented Nov 12, 2013

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

This comment has been minimized.

jackcutting commented Nov 19, 2013

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

@yang-wei

This comment has been minimized.

yang-wei commented Jan 26, 2014

Nice list, mate!

@vace

This comment has been minimized.

vace commented Apr 20, 2014

thank you!

@G1yn

This comment has been minimized.

G1yn commented May 1, 2014

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

@austinicomedez

This comment has been minimized.

austinicomedez commented Jun 23, 2014

Awesome!, thanks

@hite

This comment has been minimized.

hite commented Aug 6, 2014

FreeMarker or ftl : text.html.ftl

@benbrowning

This comment has been minimized.

benbrowning commented Aug 8, 2014

Very handy!

@xinshangshangxin

This comment has been minimized.

xinshangshangxin commented Sep 20, 2014

thanks

@lijin305

This comment has been minimized.

lijin305 commented Feb 17, 2015

Thanks.

@wzup

This comment has been minimized.

wzup commented Feb 19, 2015

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

@jdsantiagojr

This comment has been minimized.

jdsantiagojr commented Mar 5, 2015

Thank You!

@raven-chen

This comment has been minimized.

raven-chen commented Mar 30, 2015

Really helpful ! Thanks !

@JoaoFranciscoNeto

This comment has been minimized.

JoaoFranciscoNeto commented Apr 12, 2015

PostgreSQL - scope.pgsql

@maurice-schleussinger

This comment has been minimized.

maurice-schleussinger 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

This comment has been minimized.

webglider commented May 8, 2015

Prolog- source.prolog.

@dvogeldev

This comment has been minimized.

dvogeldev commented May 10, 2015

Nice! Super useful

@Eomerx

This comment has been minimized.

Eomerx commented Jun 12, 2015

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

@tadeobarranco

This comment has been minimized.

tadeobarranco commented Jun 16, 2015

Perfect man ... tanks a lot

@wonzbak

This comment has been minimized.

wonzbak commented Jul 7, 2015

thanks,

Can you add Twig: text.html.twig

@projer

This comment has been minimized.

projer commented Jul 24, 2015

Thanks for the list!

@yuntas

This comment has been minimized.

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

@SandyGifford

This comment has been minimized.

SandyGifford commented Dec 7, 2015

Thanks for the list,

is it possible to add TypeScript and React support?

.ts, .jsx, .tsx

@fjmarcelo

This comment has been minimized.

fjmarcelo commented Dec 12, 2015

Thanks a lot!!!

@skube

This comment has been minimized.

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

This comment has been minimized.

kingRayhan commented Jan 19, 2016

Thanks you very much

@awakekat

This comment has been minimized.

awakekat commented Feb 11, 2016

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

This comment has been minimized.

GarySwift commented Feb 18, 2016

@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

This comment has been minimized.

IgorGavrilenko commented Feb 18, 2016

Thank You!

@kingRayhan

This comment has been minimized.

kingRayhan commented Mar 11, 2016

Thanks you 😄

@chenshengzhi

This comment has been minimized.

chenshengzhi commented Mar 24, 2016

Thanks you 😄

@iahu

This comment has been minimized.

iahu commented Mar 28, 2016

very useful list

@jamiecalder

This comment has been minimized.

jamiecalder commented Apr 2, 2016

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

This comment has been minimized.

fro commented Apr 21, 2016

Thank you, this is so useful.

@prabhath6

This comment has been minimized.

prabhath6 commented May 3, 2016

Thanks for the list.

@victorpolko

This comment has been minimized.

victorpolko commented Aug 5, 2016

@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

This comment has been minimized.

Alien3389 commented Sep 1, 2016

There are $ symbol how to solve?

@jwt625

This comment has been minimized.

jwt625 commented Feb 5, 2017

Thanks, very useful!

@raj015

This comment has been minimized.

raj015 commented Apr 15, 2017

how to add scope for multiple file types

@jeffbruce

This comment has been minimized.

jeffbruce commented May 12, 2017

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

This comment has been minimized.

fhightower commented Jul 23, 2017

Assembly: source.assembly

@summer87279149

This comment has been minimized.

summer87279149 commented Jul 24, 2017

what's the javascript es6 scope?
image

@coderblower

This comment has been minimized.

coderblower commented Sep 13, 2017

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

@faridcher

This comment has been minimized.

faridcher commented Sep 22, 2017

@jeffreysbrother

This comment has been minimized.

jeffreysbrother commented Dec 29, 2017

Yes. As mentioned above, source.css.less doesn't work. Must be source.less.

@MicroRony

This comment has been minimized.

MicroRony commented Jul 18, 2018

Thank you so much...

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