How to make one key combination (e.g Ctrl+tab) shortcut for changing focus between two columns in sublime text

StackOverflow https://stackoverflow.com/questions/21434112

Frage

I want Ctrl+Tab to switch between two columns.

If (Column 1 is on focused) and (Ctrl+tab is pressed){
    focus to Column 2
else
    focus to column 1

I want the proper syntax for sublime text. I am learning python so I have a python file in one column and a python interpreter (through the Sublime-Repl plugin) in the other column. Using the default Ctrl+1 and Ctrl+2 shortcuts seem very tedious so i want Ctrl+Tab to do the job.

Here is the link to picture! (i cant display it here because i am new) http://www.flickr.com/photos/sadukgena/12207602826/

War es hilfreich?

Lösung

Don't know if there is a built in command to alternate, but it's straight forward with a plugin. Note that if you do not have 2 groups, nothing will happen.

import sublime_plugin


class PaneSwitch(sublime_plugin.WindowCommand):
    def run(self):
        window = self.window
        if window.num_groups() != 2:
            return
        active_group = window.active_group()
        if active_group == 0:
            window.focus_group(1)
        else:
            window.focus_group(0)

Create a plugin with the above content. The command you will bind to is pane_switch.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top