標籤:style blog http io ar color os 使用 sp
留著自已以後用:http://blog.csdn.net/nivana999/article/details/7823805
1、sublime text實現vim命令格式(Vintage外掛程式是內建的外掛程式,預設是忽略掉的)
選擇,setting user下,添加一條命令:
"ignored_packages": []
在default設定模式下,忽略了Vintage外掛程式,因為在sublime text3下預設設定檔不支援修改,所以只能在使用者配置下覆蓋掉那一項設定了。
//這條命令是把預設模式修改為命令列模式"vintage_start_in_command_mode": true
2、SublimeLinter
幹啥事情都得學會偷懶,code也是如此。儘管grunt工具提供了jshint對js代碼作檢查的外掛程式,但是,這就有點後知後覺了。如何在你code時就將錯誤給鎖定並消滅呢?還好,使用submlime的童鞋就有福了。sublimeLinter就是這樣一個提供代碼檢測的工具。
準備工作
安裝 Sublime Text 包管理工具:http://wbond.net/sublime_packages/package_control
使用 Sublime Text 包管理工具安裝 SublimeLinter:https://github.com/SublimeLinter/SublimeLinter
(注意可以用包管理工具安裝,也可以直接從git上下載sublimelinter工具後,將檔案解壓縮放入package的檔案夾下,一半路徑為:C:\Users\admin\AppData\Roaming\Sublime Text 3\Packages)
安裝 Node.js,建議安裝 Windows Installer 版本:http://nodejs.org
參數配置
開啟 SublimeLinter 的設定檔,Preferences->Package Settings->SublimeLinter->Settings - User,進行如下配置:
{ "sublimelinter": "save-only", "sublimelinter_popup_errors_on_save": true, "sublimelinter_executable_map": { "javascript": "D:/Program Files/nodejs/node.exe", "css": "D:/Program Files/nodejs/node.exe" }, "jshint_options": { "strict": false, "quotmark": "single", //只能使用單引號 "noarg": true, "noempty": true, //不允許使用空語句塊{} "eqeqeq": true, //!==和===檢查 "undef": true, "curly": true, //值為true時,不能省略迴圈和條件陳述式後的大括弧 "forin": true, //for in hasOwnPropery檢查 "devel": true, "jquery": true, "browser": true, "wsh": true, "evil": true, "unused": "vars", //形參和變數未使用檢查 "latedef": true, //先定義變數,後使用 "globals": { "grunt": true, "module": true, "window": true, "jQuery": true, "$": true, "global": true, "document": true, "console": true, "setTimeout": true, "setInterval": true } }, "csslint_options": { "adjoining-classes": false, "box-sizing": false, "box-model": false, "compatible-vendor-prefixes": false, "floats": false, "font-sizes": false, "gradients": false, "important": false, "known-properties": false, "outline-none": false, "qualified-headings": false, "regex-selectors": false, "shorthand": false, "text-indent": false, "unique-headings": false, "universal-selector": false, "unqualified-attributes": false }}
說明下:
SublimeLinter 的運行模式,總共有四種,含義分別如下:
- true - 在使用者輸入時在後台進行即時校正;
- false - 只有在初始化的時候才進行校正;
- "load-save" - 當檔案載入和儲存的時候進行校正;
- "save-only" - 當檔案被儲存的時候進行校正;
推薦設定為 “save-only”,這樣只在編寫完代碼,儲存的時候才校正,Sublime Text 運行會更加流暢。
配置 JavaScript 和 CSS 校正需要用到的 JS 引擎(這裡用的是 Node.js)的安裝路徑。
SublimeLinter 使用 JSHint 作為預設的 JavaScript 校正器,也可以配置為 jslint 和 gjslint(closure linter)。下面我使用的 jshint 校正選項,大家可以根據自己的編碼風格自行配置,選項的含義可以參考這裡:http://www.jshint.com/docs/#options
SublimeLinter 使用 CSSLint 作為 CSS 的校正器,下面是預設配置的校正選項,可以根據個人編碼風格修改。
sublime Text 幾款外掛程式