Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to auto focus the side-bar upon opening? I am not able to form a proper command in my keymap file...

I need to combine

toggle_side_bar

with

focus_side_bar
share|improve this question

See the answer to this question: http://stackoverflow.com/questions/9646552/is-it-possible-to-chain-key-binding-commands-in-sublime-text-2. Change reveal_in_side_bar to toggle_side_bar

Edit: It wasn't working for me either, but I thought it was something I was doing. Anyway, this works (for now):

import sublime, sublime_plugin

class ToggleSideBarAndFocusCommand(sublime_plugin.WindowCommand):
    def run(self):
        self.window.run_command("toggle_side_bar")
        self.window.run_command("focus_side_bar")

Run in python terminal with:

window.run_command("toggle_side_bar_and_focus")

Keymap:

{ "keys": ["ctrl+shift+9"], "command": "toggle_side_bar_and_focus" },
share|improve this answer
    
Is this working for you? I can't seem to get it right. This is what I've got: gist.github.com/3995023; does nothing – mreq Nov 1 '12 at 16:58
    
Working for me on ST3 but this is flawed in a small way. It toggles the Side Bar visibility but doesn't toggle the focus. When you toggle it to the closed state, the focus remains there. – user194149 Jul 5 '15 at 17:06

I've wrote a new plugin to do exactly the same you mentioned, take a look

https://github.com/miguelgraz/FocusFileOnSidebar

share|improve this answer
    
Yes I catched it from the Package Control's RSS :) Will check it out, thanks! – mreq Jun 11 '14 at 18:22
    
Hope it can be useful, anything please feel free to ping me! =) – Miguelgraz Jun 11 '14 at 18:25
    
@Miguelgraz Unless I'm missing something, your plugin only works if the opened file is present in the sidebar project (even with View > Side Bar > Show Open Files enabled . The OP asks about opening the sidebar and focusing it (the last selected item, anyhting). – user194149 Jul 5 '15 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .