Sublime Forum

Two independent instances of ST running?

#1

Can I get two independent instances of ST running? So that I can independently choose different themes for those editors?

0 Likes

#2

Are themes/color-schemes supported in project files? I didn’t get it working just now, but if it did work, I imagine that would be easier to maintain.

0 Likes

#3

It works with color schemes for me for projects. However, if I open a folder which does not have a project for some reason (there are some like this), it would be nice to be able to switch the theme on the fly without having to create a project and without changing the theme for all the open windows.

0 Likes

#4

The theme setting classifies as an application behaviour setting and isn’t settable per-project.

0 Likes

#5

Thank you. Does that mean I can’t have two instances of ST3 running at the same time with different themes in effect in those two?

0 Likes

#6

Generally speaking, ST tries not to run two instances, but I’ve seen it done with different versions and might also be possible with one installed, and one portable.

0 Likes

#7

The only way I know of to run two distinct instances is to run two different versions; If you try to run a second copy of the same version it just communicates its arguments to the running instance and quits.

This is a bit confusing; is there some benefit to having windows associated with projects have Default as the theme while windows without projects have the Adaptive theme (for example)?

0 Likes

#8

Tested on Windows. You can have N portable STs, hence N ST instances without interfered with each other.

2 Likes

#9

Oh, that is an excellent idea!

0 Likes

#10

What I’m looking for is a way of having different “projects” (not necessarily ST projects) opened in clearly visually distinguishable windows so that switching between them gives me visual clues which is which.

0 Likes

#11

For what it’s worth, it’s still possible to apply a color scheme to a window even if it doesn’t have a project associated with it, though you’d need a simple plugin to do so.

For example, if you open a new window you can use View > Show Console and enter the following to swap the color scheme in that window to Mariana:

window.set_project_data({'settings': {'color_scheme': 'Mariana.sublime-color-scheme'}})

That is; windows always have project data associated with them, even if there’s not a sublime-project file that’s storing it on disk.

A simple plugin could apply the appropriate setting in response to a key press, possibly toggling between multiple predefined color schemes.

3 Likes

#12

I’m looking to do something similar to your solution here, Odat. I’d like to run two ST projects side by side, and I want one to be my customized monokai theme (which lives in my User directory), and I’d like the other to be a slightly tweaked version of that customized theme–to get some visual difference between the two (one is going to be my main writing project and the other is going to be used for notes and outlining.

I understand (roughly) how your solution here assigns a whole new theme for window 2, but how (where?) should I save and then invoke a tweaked version of my user/monokai theme for my second window?

I hope that makes sense.

0 Likes

#13

The easiest thing to do to get something like this would be to use projects, so you can apply per-project settings. If you haven’t already done so, use Project > Save Project as... in the window you’d like to customize, to create a sublime-project file. Once you have a project, you can choose Project > Edit Project to open up the project file.

Projects are JSON files, and you can add a settings key to it and then add settings to it. An example of that might look like this:

{
	"folders":
	[
		{
			"path": "."
		}
	],
	"settings": {
		"color_scheme": "Monokai.sublime-color-scheme",
	},
}

Any settings here will apply to any file that’s contained inside of the window that this project is open inside of. Any of the default preferences that are classified as Editor settings can be applied here, and they’ll override the defaults.

Below is a video that shows this in action and how to work with Projects and Workspaces if you’re unfamiliar. I also have a video on how the configuration system in Sublime works that covers the topic of settings and how they apply in general (which also shows an example like this and goes into more detail on what settings you can use here).

1 Like

#14

Perfect, again. Thank you so much!

0 Likes