Sublime Forum

How to View code in your browser

#1

Iv’e attempted to create a building system to display my code ( I am on a windows) and my text looked like this:
{
“cmd”: [“‪C:\Program Files\Google\Chrome\Application\chrome.exe”, “$file”]
}

However if would not run, an alternative solution was to install View in Browser, which I did but when I hit control, alt v nothing happens.

I someone would help me with this issue I would greatly appreciate it

0 Likes

#2

You need to escape backslashes \:

{
"cmd": ["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "$file"]
}

In addition this only works if the file is saved.

0 Likes

#3

Iv’e done that as well as saved it, but it wont show up as one of the systems that has already been built, which is also why it is not running

I have the file saved as chrome

0 Likes

#4

It works OK for me (although on my machine the path is C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe).

Make sure that the file is named chrome.sublime-build; without that extension sublime will not treat it as a build system.

0 Likes

#5

Unfortunately, my problem still has not changed. Any final suggestions?

0 Likes

#6

What location did you save the file in?

0 Likes

#7

I saved it in a new folder named sublime, under my documents

0 Likes

#8

You should select “Preferences > Browse Packages…”, then double click on “User”. That’s the place you should save the file.

I’m on my phone at the moment or I’d explain better, but the short version is that Sublime will only load these kinds of files from certain places and your document directory isn’t one of them.

0 Likes

#9

Thank you so much, it works now!

1 Like

#10

just type the shortcut keys ctrl + u… source code will open in a new tab…

0 Likes

#11

Out of curiosity (of a former Windows user), can’t you use "%PROGRAMFILES%\Google\\Chrome\\Application\\chrome.exe"?

0 Likes

#12

Yes, you can use it, but you must use a shell command:

{
    "shell_cmd": "\"%PROGRAMFILES%\\Google\\Chrome\\Application\\chrome.exe\" \"$file\""
}

However as far I know this will pick the 32 Bit version, if you use the 32 Bit version of Sublime Text.

1 Like

#13

On a 64-bit installation, it will be “Program Files”, on a 32-bit installation “Program Files (x86)”. Bring in WOW64 and it gets more complicated.

0 Likes