Sublime Forum

Creating someway to run my code in a browser

#1

Sublime2 is a great code editor. Unfortunately, it doesn’t come with the default ability to run the code in a browser if you are a web programmer, this is essential. I tried to follow a method I saw here: How to view in browser
, but when it came to entering the key bindings I got stuck. Here is what it said:

The it said to:

Where I get hung up is the last part, “User Key bindings”. When I click on Command Palette I get a list box with an input box at the top. Nothing says key bindings and there are no Ok or cancel buttons of any sort.

Please help me, as a code editor without the ability to test your code is pretty useless to a web programmer.
Thanks,
Paul

0 Likes

#2

In the command palette if you type “key” you should see two options:
“Preferences: Key Bindings - Default”
“Preferences: Key Bindings - User”

Use the arrow keys to move to the one you want (“User”) and press enter to run the command, which in this case will open up a JSON file for your own key bindings.
Then just paste in the JSON you were given and save.
Now ctrl+shift+b should execute the open_browser command.

0 Likes

#3

Thank you for replying! I followed the steps like you said but it still doesn’t work :frowning:

0 Likes

#4

After pressing Ctrl-Shift-B Press Ctrl-’ (apostrophe or back-tick) to open the Console and check for any error messages.

Another option is to create a build file named, for example, PreviewInBrowser.sublime-build containing:

[code]{
//“cmd”: “C:\Users\Andrew\AppData\Local\Google\Chrome\Application\chrome.exe”, “$file”]
“cmd”: “C:\Program Files\Mozilla Firefox\firefox.exe”, “$file”]

}[/code]
This option will then be available from the Tools menu, Build System. Once you’ve selected this option it will be available to run by pressing Ctrl-B.

0 Likes

#5

Thanks for trying to help, but I think I’ll go back to Notepad++ After comparing the two, for me, Notepad++ comes out ahead. Sublime2 is just not user-friendly. :frowning:

0 Likes