Sublime Text 3专题

MarkDown语法记笔记



Sublime Text 3专题

1.下载&&安装


2.Sublime Text 便捷技巧

[以PHP为例]

1).快捷键键入当前时间:

  • 快捷键绑定[Preferences-->Key Binding--User]:{"keys":["ctrl+t"], "command":"add_current_time"}
  • 代码:保存为\Packages\User\addCurrentTime.py
import datetime
import sublime_plugin
class AddCurrentTimeCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("insert_snippet",
{
"contents": "%s" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
}

2).安装PHP语法提示:

  • 工具栏:Preferences->Package Settings->SublimeLinter->Settings - User
{"sublimelinter": true,
"sublimelinter_executable_map":
{
"php":"D:\\amp\\php\\php.exe" #把左边的地址替换为你实际的php.exe的地址
}
}

3).Ctrl+b在浏览器中打开文件【假设你已经装了Apache或者Nginx等服务器,且你的www目录为C:\www\】

  • 快捷键绑定:{ "keys": ["ctrl+b"], "command": "open_browser" }[www是你localhost的真实指向]
  • 编辑sublime Text/Data/Packages/User/open_broswer.py
url_map = {
'D:\\www\\' : 'http://localhost/',
}

4).快捷键生成代码模板[Data\Packages\SublimeTmpl\templates\php.tmpl]

【${1:}--当快速创建完文件后,鼠标将第一定位在此处;按下tab键,跳到${2:}...最后定位${0}】

  • ctrl+alt+h==>html
  • ctrl+alt+j==>javascript
  • ctrl+alt+c==>css
  • ctrl+alt+p==>php
  • ctrl+alt+r==>ruby
  • ctrl+alt++shift+p==>python
<?php
/**
* @authors : MinsonLee (694246631@qq.com)
* @blog : http://www.cnblogs.com/lms520/
* @date : ${date}
* @description: ${1:}
* @source :
* @version : \$Id\$
*/
class ${2:ClassName} ${3:extends ${4:AnotherClass}} {
$5
function __construct(){
$0
}
}

5).自定义代码模板方法2

编辑:\Data\Packages\PHP\php.sublime-snippet文件(xml方式)

<snippet>
<content><![CDATA[<?${TM_PHP_OPEN_TAG:php}
/**
* @authors : MinsonLee [email:694246631@qq.com]
* @blog : http://www.cnblogs.com/lms520/
* @date : $1
* @description: $2
* @source : $3
* @version : Version-$4
*/
$0
]]></content>
<tabTrigger>php</tabTrigger>
<scope>text.html - source.php</scope>
<description>&lt;?php … ?&gt;</description>
</snippet>

3.Sublime Text 常用快捷键【更新中...】

只写常用但比较少见的,常用的可以百度~

代码

  • ctrl+shift+[ 折叠代码
  • ctrl+shift+] 展开代码
  • ctrl+shift+up 与上行互换
  • ctrl+shift+down 与下行互换
  • ctrl+j 合并行【用来写JavaScript的数组或者是PHP里面的数组简直逆天】
  • ctrl+d 选择相同的单词
  • ctrl+/ 注释整行(如已选择内容,同“ctrl+shift+/”效果)
  • ctrl+shift+/ 注释已选择内容
  • ctrl+ku 改为大写
  • ctrl+kl 改为小写
  • Ctrl+Shift+M 选中花括号里面的全部内容不包括{}
  • alt+.               快速关闭HTML标签:例如,现在有个<div>只需要按下该快捷键,可以快速闭合</div>
  • ctrl+shift+v     完整拷贝,避免格式发生错乱(感觉这个对写前端很有用)

属性:

  • ctrl+kt 折叠属性
  • ctrl+k0 展开所有
  • ctrl+enter 插入行后
  • ctrl+shift+enter 插入行前
  • ctrl+shift+a 选择光标位置父标签对儿

行:

  • ctrl+l 选择整行(按住-继续选择下行)
  • ctrl+kk 从光标处删除至行尾
  • ctrl+shift+k 删除整行
  • ctrl+shift+d 复制光标所在整行,插入在该行之前
  • shift+tab 去除缩进
  • tab 缩进

4.Sublime Text 装逼神技能

1). 字体设置

  • 最帅的编程字体:点击Yahei Consolas Hybrid下载,双击安装
  • 设置字体:Preferences->Settings-User
{
"font_options":
[
"no_bold",/* 不是粗体显示*/
"no_italic", /*不是斜体*/
"no_antialias", /*无反图像灰度值失真显示*/
"gray_antialias",/*反图像灰度值失真显示*/
],
"font_face": "YaHei Consolas Hybrid",
"font_size": 15
}

2).打开侧栏,显示目录树:Sublime Text 3专题
View-->Side Bar-->show side bar【直接将你想的目录拖放进来,就可以看到你的目录了】

3).F9 行排序(按a-z)


10.插件推荐(不定期更新,点击链接可查看具体安装及用法):

1)MarkPreview【对于喜欢用markdown语法写东西的人来说,这个挺不错的】

**待更新中,也欢迎大家补充....**

**转载请保留博主连接**

*:first-child {
margin-top: 0 !important;
}

body>*:last-child {
margin-bottom: 0 !important;
}

/* BLOCKS
=============================================================================*/

p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}

/* HEADERS
=============================================================================*/

h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}

h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}

h1 {
font-size: 28px;
color: #000;
}

h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}

h3 {
font-size: 18px;
}

h4 {
font-size: 16px;
}

h5 {
font-size: 14px;
}

h6 {
color: #777;
font-size: 14px;
}

body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}

a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}

h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}

/* LINKS
=============================================================================*/

a {
color: #4183C4;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

/* LISTS
=============================================================================*/

ul, ol {
padding-left: 30px;
}

ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}

ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}

dl {
padding: 0;
}

dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}

dl dt:first-child {
padding: 0;
}

dl dt>:first-child {
margin-top: 0px;
}

dl dt>:last-child {
margin-bottom: 0px;
}

dl dd {
margin: 0 0 15px;
padding: 0 15px;
}

dl dd>:first-child {
margin-top: 0px;
}

dl dd>:last-child {
margin-bottom: 0px;
}

/* CODE
=============================================================================*/

pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}

code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}

pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}

pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}

pre code, pre tt {
background-color: transparent;
border: none;
}

kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}

/* QUOTES
=============================================================================*/

blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}

blockquote>:first-child {
margin-top: 0px;
}

blockquote>:last-child {
margin-bottom: 0px;
}

/* HORIZONTAL RULES
=============================================================================*/

hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}

/* TABLES
=============================================================================*/

table th {
font-weight: bold;
}

table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}

table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}

table tr:nth-child(2n) {
background-color: #f8f8f8;
}

/* IMAGES
=============================================================================*/

img {
max-width: 100%
}
-->

上一篇:Block、委托、回调函数原理剖析(在Object C语境)——这样讲还不懂,根本不可能!


下一篇:dig 常用的域名查询工具