3gwebtrain
3gwebtrain

Reputation: 15303

How to differentiate between two Sublime windows

I am running two Sublime windows at the same time. In one window I'm getting code to update the other one. Both are using the same color pattern, so I am confused between them.

My question is, is there a way to distinguish in between the windows? Making color-scheme different, or something like that?

Upvotes: 1

Views: 57

Answers (1)

MattDMo
MattDMo

Reputation: 102932

This can be done with a very simple plugin and key binding. First, select Tools -> Developer -> New Plugin... and replace the contents with the following:

import sublime_plugin


class ChangeWindowColorSchemeCommand(sublime_plugin.WindowCommand):
    def run(self):
        for view in self.window.views():
            view.settings().set("color_scheme", 
                                "Packages/Color Scheme - Default/Cobalt.tmTheme")

You should change "Packages/Color Scheme - Default/Cobalt.tmTheme" to whichever color scheme you'd like to use in the window. Save the file as Packages/User/change_window_color_scheme.py - if you just go to File -> Save it should automagically open to Packages/User.

Next, create a new key binding by selecting Preferences -> Key Bindings-User and adding the following if the file is empty:

[
    { "keys": ["ctrl+alt+shift+c", "s"], "command": "change_window_color_scheme" }
]

If you already have some custom key bindings, add the following on the line following the opening square bracket [:

{ "keys": ["ctrl+alt+shift+c", "s"], "command": "change_window_color_scheme" },

Save the file, and everything should be all set. Select the window you'd like to change the color scheme for, then hit CtrlAltShiftC, S - meaning you hit CtrlAltShiftC, release them, and hit S. You can change the key binding if you wish, of course.

Upvotes: 1

Related Questions