转载自知乎的回答
著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:Jasin Yip
链接:https://www.zhihu.com/question/24896283/answer/29380046
来源:知乎
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:Jasin Yip
链接:https://www.zhihu.com/question/24896283/answer/29380046
来源:知乎
使用 Sublime Text 建议掌握常用命令
1、查找打开过的文件:Ctrl+P,然后输入最近的文件名就可以即时预览到文件内容。
<img src="https://i-blog.csdnimg.cn/blog_migrate/3eb99412f943154a8adf25cb65b7763e.png" data-rawwidth="1027" data-rawheight="577" class="origin_image zh-lightbox-thumb" width="1027" data-original="https://pic3.zhimg.com/9b7c4d67ea55e27ec8948fb2c62b52ce_r.jpg">2、命令输入框(不知道是不是这样叫):Ctrl+Shift+P 2、命令输入框(不知道是不是这样叫):Ctrl+Shift+P
a)切换语法模式:
可以缩写为:
<img src="https://i-blog.csdnimg.cn/blog_migrate/455c8161102bc21672030cf594820336.png" data-rawwidth="568" data-rawheight="165" class="origin_image zh-lightbox-thumb" width="568" data-original="https://pic4.zhimg.com/cd557aaf5aa2070371c02f3c36d1b6d7_r.jpg">这样就可以切换语法模式了,这以便于代码高亮及插件调用(比如HTML模式会使Emmet生效)
这样就可以切换语法模式了,这以便于代码高亮及插件调用(比如HTML模式会使Emmet生效)
b)安装插件(前题是你安装了插件管理器):
<img src="https://i-blog.csdnimg.cn/blog_migrate/e65369b9793356485ef99fa6a8a3ef19.png" data-rawwidth="569" data-rawheight="76" class="origin_image zh-lightbox-thumb" width="569" data-original="https://pic2.zhimg.com/22ea96a4a0a384ea7489ad158af5cb4d_r.jpg">
输入这个命令之后回车,再输入需要的插件,就可以安装了。
<img src="https://i-blog.csdnimg.cn/blog_migrate/d4ba7b8377f2faeaa241df7073453e4c.png" data-rawwidth="425" data-rawheight="421" class="origin_image zh-lightbox-thumb" width="425" data-original="https://pic1.zhimg.com/4d0c279219fa579b46cccca30604ae60_r.jpg">
3、多处编辑功能:
Ps:这个功能至关重要,我都不敢回想接触 Sublime Text 以前是怎么活过来的。
比如这样的代码:
如果我需要为所有 h2 换成 h1,再加上一个 class="title" 属性:
那么我只需要选中一个 h2,然后按住 Ctrl+D (因为按一下只会只选择下一个)
<img src="https://i-blog.csdnimg.cn/blog_migrate/a199ac06a61c0e263d5b1cda68b205d6.png" data-rawwidth="265" data-rawheight="452" class="content_image" width="265">于是就变成: 于是就变成:
<img src="https://i-blog.csdnimg.cn/blog_migrate/fdadfff0caac820953732bc13ebb985f.png" data-rawwidth="286" data-rawheight="428" class="content_image" width="286">然后我就可以输入 h1 ,就变成 然后我就可以输入 h1 ,就变成
<img src="https://i-blog.csdnimg.cn/blog_migrate/1a8f9dc26e12712ca80ef6cc61c8c832.png" data-rawwidth="209" data-rawheight="428" class="content_image" width="209">
这个时候,按一下 HOME (Mac下是Commond + 左箭头),再按几下右箭头,再输入
然后就变成
<img src="https://i-blog.csdnimg.cn/blog_migrate/41a9d9258fca1cdae9f51cf7f9a96013.png" data-rawwidth="389" data-rawheight="423" class="content_image" width="389">
欧了~!
这个可以举一反三,巨有用巨实用!
当然 Ctrl + F 调出查找功能、Ctrl + Shift + F 调出查找并替换功能应该不用讲了。
关于编码
<img src="https://i-blog.csdnimg.cn/blog_migrate/07af8d33f0bbfccd14293b7318608e41.png" data-rawwidth="570" data-rawheight="426" class="origin_image zh-lightbox-thumb" width="570" data-original="https://pic3.zhimg.com/4441773188b44583f7bf8ea235a4dd4e_r.jpg">
File -> Reopen with Encoding 可以以某编码打开
File -> Save with Encoding 可以保存为某一编码
编码问题就是这么简单~
关于中键,也就是 鼠标滚轮!
鼠标滚轮也可以选中字符,但不同用鼠标左键选择的是,他不会跨行选择,而是直接 矩形选择,比如:
<img src="https://i-blog.csdnimg.cn/blog_migrate/2a5c22d70388f17103ffa30c2fe7b826.png" data-rawwidth="161" data-rawheight="202" class="content_image" width="161">配合 Ctrl 多处选择进行多处编辑,这直接是赞爆了有木有!! 配合 Ctrl 多处选择进行多处编辑,这直接是赞爆了有木有!!
还有菜单里这个功能超赞!可以快速设置 Tab 的宽度,默认是4,也可以 Spaces 与 Tabs 之间转换。
(btw, 习惯用 Tab 缩进的程序猿,在提交代码时转换成2个空格的缩进是个好习惯)
<img src="https://i-blog.csdnimg.cn/blog_migrate/9a3654f23da32b01c894d37c6e4f60f8.png" data-rawwidth="599" data-rawheight="610" class="origin_image zh-lightbox-thumb" width="599" data-original="https://pic2.zhimg.com/8c775c3efb3a2aef22d2cff88b993669_r.jpg">
关于插件
插件太多了,Google/百度/知乎一搜就有推荐的,这里写推荐一个~!
写前端的话 Emmet 插件是必须的,比如:
输入
按TAB,会这样
输入
按TAB,会这样
输入
按TAB,会这样
还有很多用法,可以自行Google/百度 “Emmet”。
1、查找打开过的文件:Ctrl+P,然后输入最近的文件名就可以即时预览到文件内容。
<img src="https://i-blog.csdnimg.cn/blog_migrate/3eb99412f943154a8adf25cb65b7763e.png" data-rawwidth="1027" data-rawheight="577" class="origin_image zh-lightbox-thumb" width="1027" data-original="https://pic3.zhimg.com/9b7c4d67ea55e27ec8948fb2c62b52ce_r.jpg">2、命令输入框(不知道是不是这样叫):Ctrl+Shift+P 2、命令输入框(不知道是不是这样叫):Ctrl+Shift+P
a)切换语法模式:
Set Syntax : [编程语言]
sspy
b)安装插件(前题是你安装了插件管理器):
<img src="https://i-blog.csdnimg.cn/blog_migrate/e65369b9793356485ef99fa6a8a3ef19.png" data-rawwidth="569" data-rawheight="76" class="origin_image zh-lightbox-thumb" width="569" data-original="https://pic2.zhimg.com/22ea96a4a0a384ea7489ad158af5cb4d_r.jpg">
输入这个命令之后回车,再输入需要的插件,就可以安装了。
<img src="https://i-blog.csdnimg.cn/blog_migrate/d4ba7b8377f2faeaa241df7073453e4c.png" data-rawwidth="425" data-rawheight="421" class="origin_image zh-lightbox-thumb" width="425" data-original="https://pic1.zhimg.com/4d0c279219fa579b46cccca30604ae60_r.jpg">
3、多处编辑功能:
Ps:这个功能至关重要,我都不敢回想接触 Sublime Text 以前是怎么活过来的。
比如这样的代码:
<div>
<h2></h2>
<p></p>
<p></p>
</div>
<div>
<h2></h2>
<p></p>
<p></p>
</div>
<div>
<h2></h2>
<p></p>
<p></p>
</div>
那么我只需要选中一个 h2,然后按住 Ctrl+D (因为按一下只会只选择下一个)
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/a199ac06a61c0e263d5b1cda68b205d6.png" data-rawwidth="265" data-rawheight="452" class="content_image" width="265"&gt;于是就变成: 于是就变成:
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/fdadfff0caac820953732bc13ebb985f.png" data-rawwidth="286" data-rawheight="428" class="content_image" width="286"&gt;然后我就可以输入 h1 ,就变成 然后我就可以输入 h1 ,就变成
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/1a8f9dc26e12712ca80ef6cc61c8c832.png" data-rawwidth="209" data-rawheight="428" class="content_image" width="209"&gt;
这个时候,按一下 HOME (Mac下是Commond + 左箭头),再按几下右箭头,再输入
class="title"
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/41a9d9258fca1cdae9f51cf7f9a96013.png" data-rawwidth="389" data-rawheight="423" class="content_image" width="389"&gt;
欧了~!
这个可以举一反三,巨有用巨实用!
当然 Ctrl + F 调出查找功能、Ctrl + Shift + F 调出查找并替换功能应该不用讲了。
关于编码
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/07af8d33f0bbfccd14293b7318608e41.png" data-rawwidth="570" data-rawheight="426" class="origin_image zh-lightbox-thumb" width="570" data-original="https://pic3.zhimg.com/4441773188b44583f7bf8ea235a4dd4e_r.jpg"&gt;
File -> Reopen with Encoding 可以以某编码打开
File -> Save with Encoding 可以保存为某一编码
编码问题就是这么简单~
关于中键,也就是 鼠标滚轮!
鼠标滚轮也可以选中字符,但不同用鼠标左键选择的是,他不会跨行选择,而是直接 矩形选择,比如:
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/2a5c22d70388f17103ffa30c2fe7b826.png" data-rawwidth="161" data-rawheight="202" class="content_image" width="161"&gt;配合 Ctrl 多处选择进行多处编辑,这直接是赞爆了有木有!! 配合 Ctrl 多处选择进行多处编辑,这直接是赞爆了有木有!!
还有菜单里这个功能超赞!可以快速设置 Tab 的宽度,默认是4,也可以 Spaces 与 Tabs 之间转换。
(btw, 习惯用 Tab 缩进的程序猿,在提交代码时转换成2个空格的缩进是个好习惯)
&lt;img src="https://i-blog.csdnimg.cn/blog_migrate/9a3654f23da32b01c894d37c6e4f60f8.png" data-rawwidth="599" data-rawheight="610" class="origin_image zh-lightbox-thumb" width="599" data-original="https://pic2.zhimg.com/8c775c3efb3a2aef22d2cff88b993669_r.jpg"&gt;
关于插件
插件太多了,Google/百度/知乎一搜就有推荐的,这里写推荐一个~!
写前端的话 Emmet 插件是必须的,比如:
输入
html:5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
输入
div
<div></div>
输入
section#block$*3>h2.title+p.words*2
<section id="block1">
<h2 class="title"></h2>
<p class="words"></p>
<p class="words"></p>
</section>
<section id="block2">
<h2 class="title"></h2>
<p class="words"></p>
<p class="words"></p>
</section>
<section id="block3">
<h2 class="title"></h2>
<p class="words"></p>
<p class="words"></p>
</section>
还有很多用法,可以自行Google/百度 “Emmet”。