sublime text 3 设置

时间:2022-07-15 13:33:51

最近开始用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

最后、效果图

sublime text 3  设置

5:codeformat 支持php、css、html、javascript、python、vbscript等