You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-39Lines changed: 21 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,43 +1,35 @@
1
1
# Sublime Text - View In Browser
2
2
3
3
*<ahref="http://adampresley.github.io/sublime-view-in-browser/">View In Browser</a>* is a Sublime Text plugin that will open whatever is in your
4
-
current view/tab. If the file current open is new and has not been saved a temporary
5
-
file is created (in your default temp directory for your OS) with the extension of
6
-
**.htm** and your browser will open it. However if the current open file is saved
7
-
and has a name this plugin will open it in whatever you have set to handle
8
-
its type.
4
+
current view/tab. If the file current open is new and has not been saved a temporary file is created (in your default temp directory for your OS) with the extension of **.htm** and your browser will open it. However if the current open file is saved and has a name this plugin will open it in whatever you have set to handle its type.
9
5
10
6
By default the keystroke assigned to this plugin is *CTRL + ALT + V*.
11
7
12
8
## Installation
13
-
Using the Sublime Text Package Control plugin (http://wbond.net/sublime_packages/package_control)
14
-
press *CTRL + SHIFT + P* and find **Package Control: Install Package** and press *Enter*.
15
-
Find this plugin in the list by name **View In Browser**.
9
+
Using the Sublime Text Package Control plugin (http://wbond.net/sublime_packages/package_control) press *CTRL + SHIFT + P* and find **Package Control: Install Package** and press *Enter*. Find this plugin in the list by name **View In Browser**.
16
10
17
11
## Configuring Browsers
18
12
By default this plugin will open files in Firefox. You can configure it to open
19
13
using another browser of your choice. To do this, choose *Settings - User* from *Preferences > Package Settings > View In Browser*.
20
14
21
-
The browser you wish to use to open files is set in the key named **selectedBrowser**. The list of browsers
22
-
you can use and configure are in the key named **supportedBrowsers**.
15
+
The browser you wish to use to open files is set in the key named **browser**. The following is a list of browsers configured for use out of the box.
23
16
24
-
The **supportedBrowsers** values can be configured to have paths to your browser installations.
25
-
Each browser listed is an array (list) of configurations that allow you to setup a browser
26
-
for multiple operating systems. For example under *chrome* there are two configurations.
27
-
The first is for your average Linux system. The second is for Windows.
17
+
* Firefox - Mac OS, Linux, Windows
18
+
* Chrome - Mac OS, Linux, Windows
19
+
* Chrome64 - Windows
20
+
* Safari - Mac OS
21
+
* Internet Explorer - Windows
22
+
* Chromium - Linux
28
23
29
24
## Other Browsers
30
-
View In Browser also provides key bindings to open your current view in browser other than
31
-
your **selectedBrowser**. Below is a listing of the keys and what browser open with
32
-
those key bindings.
25
+
View In Browser also provides key bindings to open your current view in browser other than your **browser** setting. Below is a listing of the keys and what browser open with those key bindings.
33
26
34
27
**CTRL + ALT + F* - Firefox
35
28
**CTRL + ALT + C* - Chrome
36
29
**CTRL + ALT + I* - Internet Explorer
37
30
**CTRL + ALT + S* - Safari
38
31
39
-
Like any other key binding in Sublime these can be changed. Below is an example of the
40
-
key configuration. You can remap these in your User key bindings configuration file.
32
+
Like any other key binding in Sublime these can be changed. Below is an example of the key configuration. You can remap these in your User key bindings configuration file.
41
33
42
34
```javascript
43
35
[
@@ -50,11 +42,7 @@ key configuration. You can remap these in your User key bindings configuration f
50
42
```
51
43
52
44
### Windows Considerations
53
-
One of the things you may notice in the Windows configuration for *chrome* is a variable in
54
-
the command path that looks like: **%Local AppData%**. This is a reference to your Windows
55
-
installation's **AppData** folder in your user profile directory. There is a variable
56
-
there because this value will differ for each user on your computer, and Chrome installs
57
-
to your **AppData** folder.
45
+
One of the things you may notice in the Windows configuration for *chrome* is a variable in the command path that looks like: **%Local AppData%**. This is a reference to your Windows installation's **AppData** folder in your user profile directory. There is a variable there because this value will differ for each user on your computer, and Chrome installs to your **AppData** folder.
58
46
59
47
Here is a list of supported variables:
60
48
@@ -67,19 +55,12 @@ Here is a list of supported variables:
67
55
***My Pictures** - Path to your pictures location
68
56
***My Music** - Path to your music location
69
57
70
-
Note that many of these are not terribly useful for determining browser location, unless you
71
-
have decided to install Firefox in your My Music folder.
72
-
58
+
Note that many of these are not terribly useful for determining browser location, unless you have decided to install Firefox in your My Music folder.
73
59
74
60
## Configure to View on Local Server
75
-
The View In Browser plugin also supports the ability to view files in the context of
76
-
a local server. So if you have a local Apache, Tomcat, or some other server application running
77
-
you can configure this plugin to open your file prefixed with a URL.
61
+
The View In Browser plugin also supports the ability to view files in the context of a local server. So if you have a local Apache, Tomcat, or some other server application running you can configure this plugin to open your file prefixed with a URL.
78
62
79
-
To configure this the View In Browser plugin reads the configuration of your currently
80
-
loaded project. You can edit a project file by opening the *sublime-project* file
81
-
by choosing **Project** -> **Edit Project**. In your project file you will need to specify
82
-
two things:
63
+
To configure this the View In Browser plugin reads the configuration of your currently loaded project. You can edit a project file by opening the *sublime-project* file by choosing **Project** -> **Edit Project**. In your project file you will need to specify two things:
83
64
84
65
***baseUrl** - The root URL to prefix files with
85
66
***basePath** - The base path where your site/application lives
@@ -103,15 +84,16 @@ Here's how that looks.
103
84
}
104
85
```
105
86
106
-
Notice the key named **settings** which is a dictionary that contains another key named
107
-
**sublime-view-in-browser**. This is where you will put your **baseUrl** and **basePath**
108
-
settings.
87
+
Notice the key named **settings** which is a dictionary that contains another key named **sublime-view-in-browser**. This is where you will put your **baseUrl** and **basePath** settings.
109
88
110
-
Now when you activate View In Browser your file will open with the HTTP protocol instead
111
-
of the FILE protocol.
89
+
Now when you activate View In Browser your file will open with the HTTP protocol instead of the FILE protocol.
112
90
113
91
## Change History
114
92
93
+
* 10/06/2014:
94
+
* Rewrite for version 2.0.0
95
+
* Using subprocess instead of webbrowser. Seems to solve #19
96
+
* Smaller, simplier sublime-settings file
115
97
* 05/15/2014:
116
98
* Current view only saves if there are modifications
0 commit comments