SublimeText3 snippet 编写
来源:互联网 发布:唱歌什么软件好 编辑:程序博客网 时间:2024/05/03 08:27
SublimeText3 snippet 编写
SublimeText2开始不再能够良好的支持Zen-Coding, 不过自己的snippet定义功能也十分强大, 类似VAssist.
在菜单tool->New Snippet中定义. 打开后是空白的snippet模板.
在 <content><![CDATA[ 和 ]]></content>之前为要定义的内容块,
在 <tabTrigger> 与 </tabTrigger> 之间定义快捷名称,
在 <scope> 与 </scope> 之间定义该snippet作用的文件类型.
例如当需要输入html5这几个字符后按tab, 就能展开为红色部分:
<snippet>
<content><![CDATA[
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>${1}</title>
</head>
<body>
<h1>${1}</h1>
Hello, ${2:this} is a ${3:snippet}!
</body>
</html>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>html5</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
</snippet>
编写好此文件后ctrl+s会弹出默认的保存路径, 一般是..\Data\Packages\User,
文件名必须以.sublime-snippet为后缀.
如此文件可保存为html5.sublime-snippet或者其他前缀名称. 一个文件中只能有一个snippet.
${1}支持补全后光标默认停留的位置, 编辑完成此处内容后按tab可以跳转到${2}的位置,
this表示2处默认内容,tab之后会选中this,${3:snippet}同理.
关于<scope>,官方定义如下:
ActionScript: source.actionscript.2AppleScript: source.applescriptASP: source.aspBatch FIle: source.dosbatchC#: source.csC++: source.c++Clojure: source.clojureCoffeeScript: source.coffeeCSS: source.cssD: source.dDiff: source.diffErlang: source.erlangGo: source.goGraphViz: source.dotGroovy: source.groovyHaskell: source.haskellHTML: text.html(.basic)JSP: text.html.jspJava: source.javaJava Properties: source.java-propsJava Doc: text.html.javadocJSON: source.jsonJavascript: source.jsBibTex: source.bibtexLatex Log: text.log.latexLatex Memoir: text.tex.latex.memoirLatex: text.tex.latexLESS: source.css.lessTeX: text.texLisp: source.lispLua: source.luaMakeFile: source.makefileMarkdown: text.html.markdownMulti Markdown: text.html.markdown.multimarkdownMatlab: source.matlabObjective-C: source.objcObjective-C++: source.objc++OCaml campl4: source.camlp4.ocamlOCaml: source.ocamlOCamllex: source.ocamllexPerl: source.perlPHP: source.phpRegular Expression(python): source.regexp.pythonPython: source.pythonR Console: source.r-consoleR: source.rRuby on Rails: source.ruby.railsRuby HAML: text.hamlSQL(Ruby): source.sql.rubyRegular Expression: source.regexpRestructuredText: text.restructuredtextRuby: source.rubySASS: source.sassScala: source.scalaShell Script: source.shellSQL: source.sqlStylus: source.stylusTCL: source.tclHTML(TCL): text.html.tclPlain text: text.plainTextile: text.html.textileXML: text.xmlXSL: text.xml.xslYAML: source.yaml
- SublimeText3 snippet 编写
- SublimeText3 snippet 编写
- SublimeText3 snippet 编写总结
- SublimeText3
- snippet
- Snippet
- sublime text学习 - Sublime中的Snippet编写
- Sublime Text 3 snippet 编写总结
- sublime text3 之snippet编写代码片段
- sublime text3 之snippet编写代码片
- 如何用sublimeText3编写less并用Nodejs自动编译成css
- SublimeText3使用
- SublimeText3 license
- sublimetext3使用
- SublimeText3快捷键
- SublimeText3注册码
- SublimeText3配置
- SublimeText3 配置
- 编写程序的32个修养
- SPOJ 220. Relevant Phrases of Annihilation
- ;lea 返回间接操作数的偏移地址
- [LeetCode]Search in Rotated Sorted Array II
- iOS开发笔记--UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte
- SublimeText3 snippet 编写
- ASP.NET中JSON的序列化和反序列化
- 环信即时通讯云iOS版V2.0.9.1服务评测
- %*c %*s printf scanf !!!
- Jquery实现SELECT多选并且左右上下移动
- crackme.chm之CKme
- spring简介
- C++,struct大小的问题
- Retrofit原理及调用流程分析