Is it possible to make side bar hidden by default? I mean, if I have opened Sublime with visible side bar and then I open another Sublime window, the side bar in the new window is also visible, which is annoying since I use Sublime as a commit message editor - the window is quite narrow and side bar takes almost half of it…
Side bar hidden by default
The side bar state in a new window seems to follow the state of the window that was active at the time that the new window was created, and as far as I’m aware there is no setting that would alter this behaviour to something else.
In theory you can force the sidebar to always be off by default no matter what with a plugin similar to this:
import sublime
import sublime_plugin
class HideSidebarListener(sublime_plugin.EventListener):
def on_post_window_command(self, window, command, args):
if command == "new_window":
window = sublime.active_window()
window.set_sidebar_visible(False)
With that in place, whenever the new_window
command has finished creating a new window, the sidebar in it will be hidden; if the current window had a sidebar, you’ll see it hiding itself.
Unfortunately, this command isn’t always triggered when a new window is opened. For example, it’s not triggered if you click the dock icon for Sublime on MacOS while Sublime is running with no windows. Similarly, executing something like subl -n
from the command line also doesn’t trigger this command. Presumably if you’re using Sublime as a commit message editor, that’s how it’s being invoked.
WIth all of that said, regardless of whether you want the side bar to be present or not, it won’t be visible unless it has something to display. The two things that the sidebar displays are the list of open folders and the list of open files. A new window won’t have any open folders, so if you turn off the display of open files, the sidebar will be hidden anyway.