Pragmatism in the real world

Hide the ST3 sidebar automatically

As a mostly keyboard user, I take advantage of the keyboard shortcuts in Sublime Text. However, the sidebar is quite a lot of effort to manage, especially as I mostly leave it closed.

Firstly, you need cmd+k,cmd+b to open it. Then you type ctrl+k,ctrl+0 to focus it as opening it doesn’t automatically set focus. Then you can navigate to the file you want and open it via pressing return. Finally, you type cmd+k,cmd+b to close it again.

That’s a lot of keyboard combinations! Note also that you swap from cmd to ctrl too.

Revealing the current file

I find that I often want to open the side bar with the currently open file highlighted. There’s a command for this: reveal_in_side_bar which you assign to a keyboard shortcut like this:

    { "keys": ["super+shift+1"], "command": "reveal_in_side_bar"},

Now, pressing cmd+shift+1 will open the sidebar with the current file highlighted. You still need to press ctrl+k,ctrl+0 to focus though.

Automating with plugins

There’s a plugin called FocusFileOnSidebar that solves this problem, so if you have this workflow, then install it now.

Again, you need to set a keyboard binding:

    { "keys": ["super+shift+1"], "command": "focus_file_on_sidebar"},

It doesn’t automatically close the sidebar for you though, so I created HideSidebarWhenNotFocussed that does just that.


With the combination of FocusFileOnSidebar and HideSidebarWhenNotFocussed, the sidebar works the way I want it to!

It’s closed most of the time, I press shift+cmd+1 to open it with focus set on the currently highlight file. If I open another file by pressing return or go back to what I was doing by pressing Esc, then the sidebar automatically closes as it should.