Sublime Forum

Starting ST4 opens a new session (Windows, change from ST3)

#1

I use Sublime Text for general note-taking and leave a lot of unsaved tabs with notes on different topics (to the extent I’m a bit anxious abt data loss if something would happen - has been flawless since ST2, though!). Very rarely use multiple windows (maybe only when changing settings).

I use a keyboard shortcut to launch ST (just calls sublime_text.exe). Pre ST4, this would open Sublime Text with all my files active if it was closed. If Sublime was already running (minimized or unfocused), it would bring the app window to the foreground and focus the last used file.

After upgrading to ST4, this behavior is changed. If I execute “sublime_text.exe” when Sublime is already running, it opens a new app window with a new/blank document. For a good while, I would panic (thinking my notes are gone), breathe & calm down, close the newly opened app window, Alt-TAB myself back to the already running instance and start note-taking. I’d love to get back to the previous behavior. Is there any hope? Command line parameteres on the .exe, maybe?

Have looked at hot_exit (always) & open_files_in_new_window (never), among others in this post: ST4 sublime_text command line always opens a new window
…but it doesn’t seem it covers what I’m after.

Think the executive summary is;
Can I (regardless of ST running or not) execute sublime_text.exe to get the app in focus (and never open a new window), as it did back in ST3?

0 Likes

#2

Oh, I might have found it already (tried sublime_text.exe /? etc, but then found subl.exe)

https://www.sublimetext.com/docs/command_line.html and https://scotch.io/tutorials/open-sublime-text-from-the-command-line-using-subl-exe-windows seem relevant here;

It seems I can change my shortcut to execute subl.exe (without parameters/other input), instead of sublime_text.exe to do what I want. Anyone see any issues doing this? I won’t lose all those unsaved notes, right? :sweat:

0 Likes

#3

No, you won’t lose notes. The subl helper is for talking to an existing instance of Sublime, and will start one running if there isn’t one.

1 Like

#4

Exactly what I need, then - thanks a lot!

0 Likes