Sublime Forum

File Manager: An optimised package

#21

Hi,
do you think there is an easy way to re-introduce “Open/Run” command as exists in Side​Bar​Enhancements package?

Thanks in advance!

0 Likes

#22

What is the open/run command? Is it just executing the file with the default application (like dbclicking on the file)?

No, I don’t think it’d be hard, but I never use it… What do you need it for?

0 Likes

#23

Uups, sorry for delay!
Yes, that’s what I am talking about.

In my specific situation, I am using pandoc to create a single file out of several individual files. Therefore I’ve created a batch/shell script to be called for assembling items.

Each time I modifiy one of theme, I need to run that script.
I know I could use a tool similar to https://www.nodesoft.com/foldermonitor, but I prefer to issue such a command manually. And for convenience, I’ve done it via ST3 file tree.

0 Likes

#24

Hum, I guess you better use a build system, or even a shortcut using the exec command? You could even do a plugin that automatically compiles the big file when you save a small one.

Create a build system (save this content into a file called Batch.sublime-build, in your User directory)

{
    "cmd": "$file",
    "selector": "source.dosbatch"
}

Then, open you batch file that builds your main file, and press ctrl+b (select batch if it asks you).

As you probably understood, I’m a bit against this feature, because sublime text comes with a much better one (build system) and I don’t think a lot of people use this feature (tell me if I’m wrong).

But, really you should create a plugin that compiles when you save. If you don’t know how to, give be a bit more infos, I’m happy to do it for you (in this case, open a new topic).

Matt

0 Likes

#25

I agree that a build system seems like a much better solution in this case; cleaner and also far less work to invoke. One of the things I really like in Sublime is how it fosters the notion that the more time you keep your hands on the keyboard, the faster you’re able to work.

Just to play devil’s advocate, the ability to “Open With” to open in another application comes in handy in situations where you have a file in your project that can’t be actively edited directly in Sublime. Some examples that I’ve run into include PDF documentation that I need to reference during a change or an Image which (while Viewable in sublime) I would like to be able to edit as well.

Of course, how handy that might be is also open to debate as well; even though I like the idea I tend to not bother working that way anyway because I’ve always got a couple of terminals open. Also it may be more of a pain to make it OS agnostic. I use Sublime on all supported platforms and if I recall correctly (been a while) SideBarEnhancements doesn’t allow you to set different programs for different OS’s, which was a bit of a pain.

0 Likes

#26

Now the term doesn’t sounds good, but a build system would do the trick, no?

@mikethedwarf As you probably guessed, I’m probably not going to include this feature. It’s going to be hard to support the different OS, and a build system should often do the trick. If it’s not the case, then a plugin should do it.

Again, @mikethedwarf if you want me to make you a plugin that compiles your files when you save them, just let me know. :slightly_smiling:

Matt

0 Likes

#27

Is it possible to trigger a build system based on the extension of an unopened file from the sidebar without having to resort to a plugin to do it? I know you can invoke the build command if you wanted to, but I thought that it would either select the build based on the currently open file or based on the presence of a known file (e.g. Makefile).

0 Likes

#28

Thanks you very much for insights!

Using “Open” was my lazy approach utilizing SideBarEnchancments plug in.

Totally agree, a build system seems to be a good and portable solution.
I did not use it that much yet because ST3-documentation (http://docs.sublimetext.info/en/latest/reference/build_systems.html) warns:

“Build system selection is currently undergoing a rework in the dev channel.
The following information may be outdated.”

Therefore I decided not to invest too much effort in understandig it. Till yet.

Anyhow, thank you for support!

0 Likes

#29

You’re asking if there’s a command build_file {"file": "my/file.ext"} and that only shows up if it’s the right extension? it sounds pretty specific. I’m don’t think there’s such command (just checked in the command reference ).

Matt

0 Likes

#30

That was my understanding as well. Without the ability to do that (without an extra plugin of some sort) I’m not sure how a build system could be used to open a file in an external application if you can’t open it in sublime first.and have it be recognized by scope.

As an example, a PDF file opens up as Plain Text and although I can view an image in Sublime, it doesn’t have a scope applied so a build system can’t be triggered for it automatically to open it in e.g. gimp.

2 Likes

#31

Well, in theory ST already knows the file’s base scope since it needs that for filetype icons, but this information isn’t exposed and not used by build systems (since they only operate on the currently active view).

1 Like