Open files in existing window in Sublime Text


Currently, when I double-click on a file in Finder, it opens a new Sublime Text window, when I already have a Sublime Text window open. This results in me having to drag the tab in the new window to the existing window. If I use the File–>Open menu in Sublime Text, it, of course, opens in the same window.

I would like the default behavior, when opening a file in Finder, to open the file in the existing Sublime Text window. I scoured through the settings/preferences in Sublime Text, but I couldn't find anything related to what I want.

Is this behavior even possible? If so, how do I modify the preferences to achieve it?

Best Answer

There's a macOS-only setting which does exactly that (taken from Preferences.sublime-settings):

// OS X only: When files are opened from finder, or by dragging onto the
// dock icon, this controls if a new window is created or not.
"open_files_in_new_window": true

When using the command-line, you can use the -a switch to append to an existing window:

subl -a index.html

The same switch could be used on Windows by modifying the default open action in the registry.