You can turn on this setting; by default it’s only turned on for MacOS, where it’s common for applications to remain running in the background when they have no windows open (though on Windows and Linux, closing the last window closes Sublime as well):
// Set to true to close windows as soon as the last file is closed, unless
// there's a folder open within the window.
// On Mac, this value is overridden in the platform specific settings, so
// you'll need to place this line in your user settings to override it.
"close_windows_when_empty": false,
There’s not a setting to create a tab when a new window is created, presumably because as soon as any content is entered a tab is created for the new file, and any opened file will also similarly get a tab. So on the whole there’s not a lot of point in it.
However, this plugin will do that whenever a new window is created and at startup for any windows that restore from the previous session with no tabs in them (which can’t happen with the setting above turned on, but better safe than surprised later):
import sublime
import sublime_plugin
def plugin_loaded():
"""
When the plugin loads (such as on startup), create an empty tab in any
window that's empty.
"""
for window in sublime.windows():
if not window.views():
sublime.set_timeout(lambda: window.run_command("new_file"))
class NewWindowListener(sublime_plugin.EventListener):
"""
When a new window is opened, create an empty tab in it.
"""
def on_post_window_command(self, winddow, command, args):
if command == "new_window":
sublime.active_window().run_command("new_file")
This video provides instructions on how to use plugins in Sublime, if you’re not sure how to do that: