如果你不需要臃腫的IDE,那C++編寫的Sublime Text絕對是快速開發(fā)的神器聚霜。它是介于Editor和IDE之間的一款軟件狡恬,極速珠叔,占極少資源。
官方文檔:http://www.sublimetext.com/docs/3/
神級代碼編輯器 Sublime Text 全程指南
http://www.cocoachina.com/programmer/20150715/12550.html
新編碼神器Atom使用紀要 | 太耗資源弟劲,類似Chrome
http://jeffjade.com/2016/03/03/2016-03-02-how-to-use-atom/
插件管理器 Package Control https://packagecontrol.io/installation
Ctrl + `
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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://packagecontrol.io/' + 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)
For Sublime3:
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; 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://packagecontrol.io/' + 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)
快捷鍵:Ctrl+Shift+P
安裝Vue高亮插件
Ctrl+Shift+P -> PCIP -> Vue Syntax Highlight
安裝完祷安,重新打開Sublime就可以高亮Vue了。
導出配置:備份以下整個目錄
Windows: %APPDATA%\Sublime Text 3
“C:\Users<User_ID>\AppData\Roaming\Sublime Text 3”
Sublime技巧兔乞,劃重點
多重編輯: 雙擊(或Ctrl + D) -> Alt+F3
Ctrl + D選擇當前光標所在的詞并高亮該詞所有出現(xiàn)的位置汇鞭,再次Ctrl + D選擇該詞出現(xiàn)的下一個位置,在多重選詞的過程中庸追,使用Ctrl + K進行跳過霍骄,使用Ctrl + U進行回退,使用Esc退出多重編輯淡溯。
列模式: Ctrl + Shift + L可以將當前選中區(qū)域打散读整,然后進行同時編輯
有打散自然就有合并,Ctrl + J可以把當前選中區(qū)域合并為一行
跳轉到文件 Ctrl + P會列出當前打開的文件
F12快速跳轉到當前光標所在符號的定義處(Jump to Definition)
Sublime Text支持代碼段(Code Snippet)咱娶,輸入代碼段名稱后Tab即可生成代碼段米间。http://www.hongkiat.com/blog/sublime-code-snippets/
- 自定義Snippet
- "vues" --> 快速創(chuàng)建export default {所有元素}
格式化(Formatting)
Sublime Text基本的手動格式化操作包括:Ctrl + [向左縮進,Ctrl + ]向右縮進膘侮,此外Ctrl + Shift + V可以以當前縮進粘貼代碼(非常實用)屈糊。
- [HTML/CSS/JS Prettify] 插件,格式化Vue文件:
安裝后 tools->HTML/CSS/JS Prettify->Plugin Options - Default
在"html" allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg","vue"] 加上vue就好了 - 格式化快捷鍵:Ctrl+Shift+H
用SublimeREPL以進行多行編碼實驗(Experiments)琼了。
使用BracketHighlighter插件以高亮顯示配對括號以及當前光標所在區(qū)域
"bracket_styles": {
"default": {
"icon": "dot",
"color": "brackethighlighter.default",
"style": "hightlight"
}
}
中文輸入法(包括日文輸入法)都有一個問題:輸入框不跟隨:
解決方法是安裝 IMESupport 插件逻锐,之后重啟Sublime Text問題就解決了。
個人使用的設置項(Miscellaneous Settings)
// 設置Sans-serif(無襯線)等寬字體表伦,以便閱讀
"font_face": "YaHei Consolas Hybrid",
"font_size": 12,
// 使光標閃動更加柔和
"caret_style": "phase",
// 高亮當前行
"highlight_line": true,
// 高亮有修改的標簽
"highlight_modified_tabs": true,
Google為每一門主流語言都設置了其代碼規(guī)范(Code Style Guideline)谦去。我自己通過下面的設置使以規(guī)范化自己的代碼。
// 設置tab的大小為2
"tab_size": 2,
// 使用空格代替tab
"translate_tabs_to_spaces": true,
// 添加行寬標尺
"rulers": [80, 100],
// 顯示空白字符
"draw_white_space": "all",
// 保存時自動去除行末空白
"trim_trailing_white_space_on_save": true,
// 保存時自動增加文件末尾換行
"ensure_newline_at_eof_on_save": true,
#Preferences -> Setting 我的設置:
{
"color_scheme": "Packages/User/SublimeLinter/Monokai JSON+ (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
],
"match_brackets": false,
"match_brackets_angle": false,
"match_brackets_braces": false,
"match_brackets_content": false,
"match_brackets_square": false,
"match_tags": false,
"rulers":
[
80,
100
],
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
# My Prefer Packages:
Babel
BracketHighlighter
Emmet
HTM-CSS-JS Prettify
IMESupport
JSON L18n Resource Editor
MarkdownLight
MarkdownLivePreview
Monakai JSON+
Package Control
Pretty JSON
Pug
SublimeLinter
SublimeLinter-contrib-eslint
Vue Syntax Highlight
Vuejs Snippets
Global Snippet:
v
vue - Vue instance
vued - Vue directive
vuef - Vue filter
vuenexttick - Vue.nextTick()
Component + Options/Data
vuec - Vue component
vueccomputed - Vue computed props
vuecdata - Vue component data
vuecmethods - Vue component methods
vuecmixins - Vue component mixins
vuecprops - Vue component props
vuecwatch - Vue component watch
Vue Resource
vueht - this.$http()
vuehtget - this.$http.get()
vuehtpost - this.$http.post()
Vue Router
vuert - this.$route
vuertgo - this.$route.router.go()
Directives:
v-bind - :prop="data"
v-el - v-el:el-name
v-else - <div v-else>
v-for - <div v-for="item in items">
v-if - <div v-if="">
v-link - <a v-link="">
v-on - @evt="callback"
v-ref - v-ref:ref-name
20170913 sublime 一年后又更新了:sublime text 3 build 3143