Sublime Forum

Edit/Run file in default app

#1

Is there an option to run/edit file from Sublime Text using a default app assigned to this file type?

For example, when I double-click an HTML file, it is normally opened in Chrome. And so when I edit an HTML file using Sublime Text, I want to have a command that will open that file in Chrome.

0 Likes

#2

In shell,

  • For Windows, you can do $ start file
  • For Linux, you can do $ xdg-open file
  • For Mac, you can do $ open file

So you can write a plugin to do the right job on different platforms.

1 Like

#3

That’s interesting, thanks. But it seems it doesn’t work out-of-the-box from ST console?

I have tried it with and without $ on Windows, and it always gives me syntax error.

start file
start test.html
$ start file
$ start test.html
0 Likes

#4

That’s why I say “In shell”. They are OS things and not related to ST.

By convention, the leading $ just means the command is run with a normal user rather than root (admin), which usually uses leading # to denote.

0 Likes

#5

Thanks. FWIW, there is an abandoned package for this, SublimeText/OpenDefaultApplication: Sublime Text plugin to open files in the system default application (github.com)

0 Likes

#6

Not abandoned but nothing to be updated I guess.

0 Likes

#7

No :slight_smile: Have tested it myself just now, and there is an open issue to provide Sublime Text 2 support…

0 Likes