schoenburg
schoenburg

Reputation: 21

How to open Sublime Text files in window based on extension?

Is there any way to get Sublime to open all files of a certain extension in the same window? For example, when using a 2x2 grid, I'd like to keep all SCSS files in the upper left, all HAML in upper right, JS lower left and search in lower right. I'd like to use the search function, and have files go to the other three tabs instead of the search window each time.

I've tried the 'open in relevant window' plugin and it doesn't appear to make any difference.

When opening lots of files it gets very tedious opening them and having to manually move them to a window that wasn't active when opening.

Edit: I'm working on a Mac, so I'd need something that works there, or preferably cross platform.

Upvotes: 0

Views: 152

Answers (1)

Cory
Cory

Reputation: 1802

Edit: Op is working on a Mac, I'll leave this in case any windows users are interested in this solution.

---

Perhaps an extra shell extension would help.

If you're familiar with the Registry, you can create a new key that opens all selected files in a new window. Simply create a modified version of what Sublime Text already has.

The existing key for Sublime Text exists here:

HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command

With the default value of (depending on version):

C:\Program Files\Sublime Text 3\sublime_text.exe "%1"

You could create a new key like so:

HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text (new window)\command

Then add the -n arguement to the default value:

C:\Program Files\Sublime Text 3\sublime_text.exe -n "%1"

This will create a new window every time you use the shell extension to open files and will keep multiple files organized in the same window.

To take this a step further, if you have any programming experience you could create your own shell extension which takes a list of files and groups them for you, which then in turn can create the new windows programmatically.

Upvotes: 1

Related Questions