Shortcut in the editor to open HTML in the Navigator

Asked

Viewed 6,731 times

1

I’m studying html and javascript, I wonder if there is any way inside the sublime that by pressing for example F12, the file can be opened directly by some browser. No need to save the file and click on it in the directory and ask to open as.

  • I think this https://browsersync.io/ solves your problem.

2 answers

2

You can use the https://github.com/adampresley/sublime-view-in-browser

  • In sublimetext open the Package Control (use the shortcut Ctrl + Shift + P)

  • Then select Install Package

  • After this type View in Browser

After installed open an html document and press Ctrl+Alt+V, will open the document in your main browser.

Configuring Multiple Browsers

To configure multiple browsers go to the following menu: Preferences > Key Bindings

Then edit the document to something similar to this:

[
    { "keys": [ "ctrl+alt+v" ], "command": "view_in_browser" },
    { "keys": [ "ctrl+alt+f" ], "command": "view_in_browser", "args": { "browser": "firefox" } },
    { "keys": [ "ctrl+alt+c" ], "command": "view_in_browser", "args": { "browser": "chrome" } },
    { "keys": [ "ctrl+alt+i" ], "command": "view_in_browser", "args": { "browser": "iexplore" } },
    { "keys": [ "ctrl+alt+s" ], "command": "view_in_browser", "args": { "browser": "safari" } }
]

Of course to work you will need to have the browsers installed, so you can configure the browsers you want.

-1

Create a shortcut as follows: in the navigation bar of the sublime click on preferences>key bindings A new window will appear showing the editor’s default shortcuts in one column and another will have one for you user add shortcuts. Add the following shortcut: { "Keys": ["F12"], "command": "open_in_browser" }, You can also use other keys as an example ["Ctrl+shift+F12"], just check that the shortcut has not been used yet because there are many already defined.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.