Sublime Text3不安装插件修改默认浏览器并设置快捷键
看了好多文章 ,第一步都是要求安装SideBarEnhancements插件,所以我觉得有必要把我的解决方法分享给遇到相同问题的程序员。(我自己强迫症在那搞了三个多小时才整好的。。。)
1.设置默认浏览器
在打开的文件中输入如下代码:(以chrome浏览器为例) 注意ctrl+s保存
{
“default_browser”: “chrome”//one of this list: firefox, , canary, chromium, opera, safari, ie
}
保存后,在html文件上右键Open In Browser->Default,即可用chrome打开html;
2.使用不同浏览器打开网页的快捷键设置
然后在打开的配置文件中添加下面的代码,ctrl+s 保存;
[
{ “keys”: [“f1”], “command”: “side_bar_files_open_with”,
“args”: {
“paths”: [],
“application”: “C:\Program Files (x86)\Google\Chrome\Application\Chrome”,
“extensions”:".*",
},
},
{ “keys”: [“f2”], “command”: “side_bar_files_open_with”,
“args”: {
“paths”: [],
“application”: “C:\Program Files (x86)\Internet Explorer\iexplore”,
“extensions”:“html”,
},
},
]
上面的代码设置效果为:
“F1”键 可运行chrome浏览器来展示当前页面,不管它是什么格式的文件;
“F2” 键,如果当前页面是html页面,才会运行IE浏览器来展示页面;
#注意:
在保存配置文件的时候,如果报错类似:error trying to parse file:xxx 的时候,一般情况都是配置代码中缺少了一些关键符号,比如逗号,引号等,也可能多了些不必要的符号,导致无法解析;
快捷键设置必须要是小写;