Sublime Forum

ST3 on Windows: How to save project state without exiting?

#1

The SublimeRestart plugin restarts ST3 on Windows like this:

subprocess.call('taskkill /im sublime_text.exe /f && cmd /C "'+ os.path.join(os.getcwd(), 'sublime_text.exe') + '"', shell=True)
Full code] The problem is, when Sublime restarts, the active project is the one from the last time Sublime was properly exited.

Changing it to

self.window.run_command('exit') subprocess.call(os.path.join(os.getcwd(), 'sublime_text.exe'))
Full code] causes it to hang for 20-30 seconds before exiting, and then does not restart it at all.

Is there a way to do something like this?

self.window.run_command('save_current_project_state') subprocess.call('taskkill /im sublime_text.exe /f && cmd /C "'+ os.path.join(os.getcwd(), 'sublime_text.exe') + '"', shell=True)
Or to just handle this in a different way?

Thanks.

0 Likes

#2

I’ve come up with a reasonable workaround: ctrl+shift+w to close Sublime, and then F10 to open it, which I’ve assigned to it’s taskbar shortcut.

0 Likes