How do I force opening new files in left pane/column in Sublime Text 2?

Solution 1:

There's no native way to do this in Sublime Text 2. What you want is to be able to switch to the left window group (group 0), open a file, and then (possibly, its not clear from your question) switch back to the right window group (group1).

This can be accomplished with a series of Sublime Text Commands. Specifically move_to_group,prompt_open_file,move_to_group.

Unfortunately, Sublime's native capability for stringing together commands, macros, only works on text manipulation commands, not window commands. And keybindings only accept single commands. So you have 2 options

Plugin-free option

Just type Ctrl+1 before you hit Ctrl+O. This is a fairly quick way to switch to the left window group and open the file. You can then use Ctrl+2 to switch back afterwards if needed.

The full (more involved) solution

You can install the plugin code found on Sublime's forums to create a "run multiple commands" command. You can then create a keybinding for what you want. I'm guessing you would want it to just override the default open option, so lets bind it to Ctrl+O

{ "keys": ["ctrl+o"],
    "command": "run_multiple_commands",
    "args": {
         "commands": [
            {"command": "move_to_group", "args": {"group": 0 }, "context": "window"},
            {"command": "prompt_open_file", "context": "window"},
            {"command": "move_to_group", "args": {"group": 1 }, "context": "window"}
          ]}}

This will then work after you install the plugin from the link, reproduced below. To install it, you can just install it as a .py file in your %APPDATA%\Sublime Text 2\Packages\User folder.

# run_multiple_commands.py
import sublime, sublime_plugin

# Takes an array of commands (same as those you'd provide to a key binding) with
# an optional context (defaults to view commands) & runs each command in order.
# Valid contexts are 'text', 'window', and 'app' for running a TextCommand,
# WindowCommands, or ApplicationCommand respectively.
class RunMultipleCommandsCommand(sublime_plugin.TextCommand):
  def exec_command(self, command):
    if not 'command' in command:
      raise Exception('No command name provided.')

    args = None
    if 'args' in command:
      args = command['args']

    # default context is the view since it's easiest to get the other contexts
    # from the view
    context = self.view
    if 'context' in command:
      context_name = command['context']
      if context_name == 'window':
        context = context.window()
      elif context_name == 'app':
        context = sublime
      elif context_name == 'text':
        pass
      else:
        raise Exception('Invalid command context "'+context_name+'".')

    # skip args if not needed
    if args is None:
      context.run_command(command['command'])
    else:
      context.run_command(command['command'], args)

  def run(self, edit, commands = None):
    if commands is None:
      return # not an error
    for command in commands:
      self.exec_command(command)