最近開始用sublime text 3,查資料總結了一下常用的設置,記錄下以備用,同時也希望能改大家帶來方便
0、使用package control安裝,點前邊超鏈接,復制左側代碼到console,回車執行
sublime text 3:
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)
安裝完之后,若是連不上,則修改hosts文件,{IPv4 address}sublime.wbond.net
其次若無法訪問channel_v3.json:package settings-->package control-->settings-user添加以下片段,
"channels":
[
"https://packagecontrol.io/channel_v3.json",
"https://web.archive.org/web/20150905194312/https://packagecontrol.io/channel_v3.json"
],
1、高亮修改中選項卡
preferences-User,一般會打開如下類似目錄
linux下:/home/你的用戶名/.config/sublime-text-3/Packages/User
windows下:C:\Users\你的用戶名\AppData\Roaming\Sublime Text 3\Packages\User
添加一個文件,文件名:Default.sublime-theme
文件內容
[{
"class": "tab_control",
"attributes": ["selected", "file_medium_dark"],
"tint_modifier": [0, 255, 0, 80]
}]
選項卡中變綠色的功能
2、常用設置。在上邊同樣位置,添加一個文件,文件名:Preferences.sublime-settings
文件內容
{
"font_size": 12, //設置字體大小, 我比較喜歡大一點的字體
"ignored_packages": //設置忽略文件類型, 第二個是默認忽略的, 第一個markdown文件我使用另一種文件打開,
[
"Markdown",
"Vintage"
],
"create_window_at_startup": false, //取消啟動時,自動打開新窗口的設置, 這個設置很惡心, 每次啟動后會自動生成一個空白窗口
"open_files_in_new_window": false, //取消打開文件時會新生成一個窗口, 默認設置每次打開一個項目會重新生成一個窗口
"highlight_line": true, //高亮當前編輯行, 其實高亮的不明顯
"highlight_modified_tabs": true, //文件還未未保存修改時, 標簽黃色高亮提示,
"show_encoding": true, //在窗口右下角顯示打開文件的編碼
"translate_tabs_to_spaces": true, //將tab鍵的形式改為四個空格,
"update_check": false //關閉自動更新
}
3、括號匹配,使用package control安裝brackethighlighter,方法:ctrl+alt+p,輸入install,然后輸入brackethighlighter,回車安裝,然后進行配置
同樣在上述位置,建立一個文件,文件名:bh_core.sublime-settings
文件內容
{
"bracket_styles": {
"default": {
"icon": "dot",
"color": "brackethighlighter.default",
"style": "outline"
},
"unmatched": {
"icon": "question",
"color": "brackethighlighter.unmatched",
"style": "outline"
},
"curly": {
"icon": "curly_bracket",
"color": "brackethighlighter.curly",
"style": "outline"
},
"round": {
"icon": "round_bracket",
"color": "brackethighlighter.round",
"style": "outline"
},
"square": {
"icon": "square_bracket",
"color": "brackethighlighter.square",
"style": "underline"
},
"angle": {
"icon": "angle_bracket",
"color": "brackethighlighter.angle",
"style": "underline"
},
"tag": {
"icon": "tag",
// "endpoints": true,
"color": "brackethighlighter.tag",
"style": "outline"
},
"c_define": {
"icon": "hash"
// "color": "brackethighlighter.c_define",
// "style": "underline"
},
"single_quote": {
"icon": "single_quote",
"color": "brackethighlighter.single_quote",
"style": "outline"
},
"double_quote": {
"icon": "double_quote",
"color": "brackethighlighter.double_quote",
"style": "outline"
},
"regex": {
"icon": "regex"
// "color": "brackethighlighter.quote",
// "style": "underline"
}
},
}
4、代碼提示,ctrl+alt+p,輸入install,然后輸入SublimeCodeIntel,回車安裝
支持:JavaScript, Mason, XBL, XUL, RHTML, SCSS, Python, HTML, Ruby, Python3, XML, Sass, XSLT, Django, HTML5, Perl, CSS, Twig, Less, Smarty, Node.js, Tcl, TemplateToolkit, PHP
最后、效果圖
5:codeformat 支持php、css、html、javascript、python、vbscript等