Sublime Forum

[SOLVED] New blank preview when all tabs closed

#1

I’m not quite sure what to search for but so far I haven’t found the answers I’m looking for so I’m posting here.

I am using Sublime on Windows 7 and when I open Sublime, provided I didn’t have any tabs open when I last quit, it will show me a preview of a blank new file which I can immediately start typing in.

Is it possible for a new blank file preview of the same kind to be created automatically when all existing tabs are closed?
I have looked in the settings files for options that might enable this and I haven’t foudn any so far.

Any help would be appreciated.

0 Likes

#2

I have found the solution to my problem.
Basically I need to learn more about creating plugins.

This is the code I came up with to do it:

[code]import sublime, sublime_plugin

class PermanentPreviewCommand(sublime_plugin.EventListener):
def _check_views(self):
if len(sublime.active_window().views()) <= 1:
sublime.active_window().new_file(sublime.TRANSIENT)

def on_close(self, view):
	self._check_views()[/code]
0 Likes