Sublime Text 3 套件
1.安裝Sublime Package Control
View->Show Console
使用以下Command安裝:
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
2.安裝套件
Perferences > Package Control,或是按下Ctrl (CMD in MAC)+ Shift + P
輸入Package Control: Install Package,開始安裝套件
推介以下套件:
react-native-snippets
ALignment
Emmet
babel
JsFormat
Terminal
套件簡介及設定:
react-native-snippets
之前提到的超好用插件,節省大量輸入時間,例如輸入 rncc ,會自動生成React Native 的類
ALignment
排列對齊功能,能把選取的區塊快速排列對齊
command + control + a
Emmet
preferences -> Key bindings - Users
把以下Code放入[]
{
"keys": \[
"super+e"
\],
"args": {
"action": "expand\_abbreviation"
},
"command": "run\_emmet\_action",
"context": \[{
"key": "emmet\_action\_enabled.expand\_abbreviation"
}\]
},
{
"keys": \["tab"\],
"command": "expand\_abbreviation\_by\_tab",
"context": \[{
"operand": "source.js",
"operator": "equal",
"match\_all": true,
"key": "selector"
}, {
"key": "preceding\_text",
"operator": "regex\_contains",
"operand": "\(\\b\(a\\b\|div\|span\|p\\b\|button\)\(\\.\\w\*\|>\\w\*\)?\(\[^}\]\*?}$\)?\)",
"match\_all": true
}, {
"key": "selection\_empty",
"operator": "equal",
"operand": true,
"match\_all": true
}\]
}
babel
打開.js, .jsx 後綴的文件,點擊View -> Syntax -> Open all with current extension as... -> Babel -> JavaScript (Babel)
即可設置babel為默認 javascript 打開syntax
JsFormat
美化JS檔用
preferences -> Package Settings -> JsFormat -> Setting - Users,输入以下代码:
{ "e4x": true,
// jsformat options
"format_on_save": true,
}
Terminal
在檔案上右鍵直接開啟Terminal
如要set做預設開啟iTerm2
Sublime Text -> Preferences -> Package Settings -> Terminal -> Settings-User
{
"terminal": "iTerm2-v3.sh",
"parameters": ["open_terminal_project_folder"]
}