码迷,mamicode.com
首页 > 其他好文 > 详细

sublimi 自定义快捷代码

时间:2017-11-07 22:58:00      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:c#   lin   json   选择   yaml   scale   osb   ops   asc   

选择打开tools ->developer->new snippet

<snippet>
<content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.  
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->不同类型文件名在scope里用逗号分隔;如: text.html,source.php
</snippet>

将红色的代码替换成你想要快捷生成的代码

<snippet>
<content>
<![CDATA[
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>${1:site title}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<link href="" rel="stylesheet">

<script src="" type="text/javascript"></script>
<style>
${2}
</style>
</head>

<body>

${0}

</body>
</html>
]]>

</content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>myhtml</tabTrigger><!-- 触发该短代码段的输入文字 -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html,source.php</scope><!--定义在那些文件中生效-->
</snippet>

 

 

保存在user文件夹一般保存会弹出默认的保存地址C:\用户\计算机用户名\AppData\Roaming\Sublime Text 3\Packages\User;保存格式:文件名.sublime-snippet

在html输入myhtml 在按tab键自定义的代码就出现啦!

 

 

${1:site title}  表示光标第一次停留的位置并且默认选中site title

${2}光标第二次停留的位置(即地二次按tab键)

${0}光标最后停留的位置

 

<scope>text.html,source.php</scope><!--定义在那些文件中生效-->

包括的文件类型:

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

sublimi 自定义快捷代码

标签:c#   lin   json   选择   yaml   scale   osb   ops   asc   

原文地址:http://www.cnblogs.com/lichihua/p/7801526.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!