I would like Sublime Text to open my scratchpad by default, is there any way to facilitate this?
Asked
Active
Viewed 452 times
1
-
Consider telling us what you've tried so far. Have you tried googling this? – Jedediah Sep 05 '13 at 13:55
2 Answers
0
Might be something better, but you can use something like this.
import sublime
VERSION = int(sublime.version())
def open_default_file():
settings = sublime.load_settings("Preferences.sublime-settings")
if settings.has("default_file"):
sublime.active_window().open_file(settings.get("default_file"))
else:
scratch_name = "Scratch Space"
found = False
window = sublime.active_window()
views = window.views()
for view in views:
if view.name() == scratch_name and view.file_name() == None:
found = True
window.focus_view(view)
break
if not found:
view = sublime.active_window().new_file()
view.set_scratch(True)
view.set_name("Scratch Space")
If you want a specific file opened, you can specify a file (as a string) in Preferences.sublime-settings
using the key default_file
. If you just want a general scratch file, you don't have to add anything.

skuroda
- 19,514
- 4
- 50
- 34
0
I've made a plugin for this:
https://packagecontrol.io/packages/Scratchpad
Presently there is no option to choose the location of the file, will consider adding it if required.

Anunay Inuganti
- 273
- 1
- 3
- 14