当前位置:Sublime Text中文网 >

sublime Text3设置快捷键实现多个浏览器预览

由于不同浏览器内核不同,解析样式也不一样。我们经常需要调试页面在不同浏览器下的显示情况,通过sublime Text3下增加快捷键的办法,可以一键启动多个浏览器,节省时间又方便快捷。

首先安装 SideBarEnhancements

然后通过ctrl + k, ctrl + b打开侧边栏,在侧边栏的文件中右击,找到 open width -> edit applications

然后在这里边设置firefox打开的方式。

application : 路径要修改为自己默认安装的路径。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[
   {"id": "side-bar-files-open-with",
       "children":
       [
           //application firefox
           {
               "caption": "firefox",
               "id": "side-bar-files-open-with-firefox",

               "command": "side_bar_files_open_with",
               "args": {
                           "paths": [],
                           "application": "D:\\Program Files\\Mozilla Firefox\\firefox.exe",
                           "extensions":".*" //any file with extension
                       }
           },

           {"caption":"-"},
           {
               "caption": "chrome",
               "id": "side-bar-files-open-with-chrome",

               "command": "side_bar_files_open_with",
               "args": {
                           "paths": [],
                           "application": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
                           "extensions":".*" //any file with extension
                       }
           }
       ]
   }
]

Key bindings -> User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[
    { "keys": ["ctrl+shift+c"], "command": "copy_path" },
    { "keys": ["alt+f12"], "command": "open_in_browser" },
    { "keys": ["f12"], "command": "side_bar_files_open_with",
            "args": {
               "paths": [],
               "application": "D:\\Program Files\\Mozilla Firefox\\firefox.exe",
               "extensions":".*" //any file with extension
           } },
   { "keys": ["ctrl+f12"], "command": "side_bar_files_open_with",
           "args": {
               "paths": [],
               "application": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
               "extensions":".*" //any file with extension
           }
    }    
   
]

这样就可以用这三个键在浏览中预览页面了:

F12 : Firefox

alt + F12 : IE

ctrl + F12 : chrome