sublime text 3 使用简介

2014年1月22日 09:47:50

2用了一段时间感觉不错,就是自带的高亮显示匹配标签或者代码块儿时有点儿不清楚,所以一直是sublime 开PHP,notepad++开html

现在想只用一个编辑器,放弃两个来回切换,正好前端时间知道3出来了,索性就换成3吧

1.下载sublime text 3 便携版(不知道安装版为什么不能通过window7关联设置)

http://www.sublimetext.com/3

2.安装插件包管理:调出控制台:view>show console,复制代码到光标闪烁的文本框中,回车.(点开该链接复制,或者直接复制下边代码)

https://sublime.wbond.net/installation

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

3.安装使用插件(我安装了BracketHighlighter, alignment, GoToLastEditEnhanced)

http://dengo.org/archives/923

https://packagecontrol.io/packages/GotoLastEditEnhanced

ctrl+shift+p 调出命令框输入install package,等回车后等一会儿,在再次出现的命令框中输入想要安装的插件包名字,选中后回车就行了

bracket highlighter是用来高亮显示代码块儿的,包括PHP和html其它编程语言应该也可以(安装后需要重启sublime)

下边是我觉得不错的配置(preferences>package settings>bracket highlighter>bracket settings-user,复制进去就行了):

{

    "high_visibility_enabled_by_default": true,

    "high_visibility_style": "outline",

    "high_visibility_color": "__default__",

    "match_only_adjacent": true

}

alignment 是用来将等号对齐的,但是它的快捷键和QQ截图的快捷键冲突了,我修改了下(preferences>package settings>alignment>key bindings-user,她的user配置文件和sublime的key bindings-user配置文件共用)

{ "keys": ["alt+a"], "command": "alignment" }

GoToLastEditEnhanced

//快捷键绑定

{ "keys": ["ctrl+1"], "command": "goto_last_edit_enhanced", "context": [{"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} ] }, //定位到上一次编辑的位置

{ "keys": ["ctrl+2"], "command": "goto_last_edit_enhanced", "args": {"backward": true }, "context": [{"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} ] }//定位到下一个编辑的位置



//user 自定义设置

"sublime_enhanced_keybindings": true

 另外一个GoToLastEdit

下边的配置是我自己用的sublime的key bindings-user配置

[

    { "keys": ["ctrl+`"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },

    { "keys": ["ctrl+d"], "command": "duplicate_line" },

    { "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },

    { "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },

    { "keys": ["alt+a"], "command": "alignment" },

    { "keys": ["alt+z"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, // 查找文件名

    { "keys": ["ctrl+1"], "command": "goto_last_edit_enhanced", "context": [{"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} ] }, // 定位到上一次编辑的位置

    { "keys": ["ctrl+2"], "command": "goto_last_edit_enhanced", "args": {"backward": true }, "context": [{"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} ] } //定位到下一个编辑的位置

]

 

说明: 

ctrl+`删除当前行;

ctrl+d 复制当前行,或选中内容

ctrl+q 添加注释,自动判断内容该添加什么样的注释,按第二次取消注释

另外, sublime 的对话框都是可以按键盘的 esc 键关闭的

我的主题/插件设置:

 1 {

 2     "color_scheme": "Packages/Color Scheme - Default/Dawn.tmTheme",

 3     "copy_with_empty_selection": false,

 4     "font_size": 11.4,

 5     "highlight_line": true,

 6     "ignored_packages":

 7     [

 8         "Vintage"

 9     ],

10     "word_wrap": false,

11     "sublime_enhanced_keybindings": true //转到上一次编辑的地方用

12 }

 

 另: 其它一些快捷键

f12:  转到函数的原始定义文件

ctrl+p : 在当前工程总查找某文件

你可能感兴趣的:(Sublime Text)