sublime text3 snippets 代码片段

sublime text3 snippets 代码片段

资源地址

注意

  • 1 如果snippet无法触发,可能是因为scope不对.参考上面的链接. 例如markdown的scope, 不是 source.md, 是 text.html.markdown
  • 2 scope中可以写多个触发语言, 用 , 隔开就可以了.
  • 3 对于snippet片段存储地点, 可以在 User目录下 建立一个 snippet文件夹, 所有自定义的代码片段放在这个目录中.
  • 4 代码片段的后缀名必须是 .sublime-snippet
  • 5 一个简单的代码片段. 下面的片段中在 python ,markdown文件都会触发.
<snippet>
    <content><![CDATA[
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>py-header</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.python,text.html.markdown</scope>
    <description>python file header</description>
</snippet>
  • 6 sublime text3 中的 scope
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
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
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
Scala: source.scala
Shell Script: source.shell
SQL: source.sql
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

猜你喜欢

转载自blog.csdn.net/cd_za/article/details/86531181