2014年1月22日 09:47:50
2用了一段時間感覺不錯,就是自帶的高亮顯示匹配標簽或者代碼塊兒時有點兒不清楚,所以一直是sublime 開PHP,notepad++開html
現在想只用一個編輯器,放棄兩個來回切換,正好前端時間知道3出來了,索性就換成3吧
1.下載sublime text 3 便攜版(不知道安裝版為什么不能通過window7關聯設置)
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)
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 : 在當前工程總查找某文件