Sublime Forum

Disable automatic loading of last session

#1

How can I tell Sublime not to open previously-open directories when I launch it? My ideal workflow would be

$ cd path/where/I/want/to/work $ subl .

After doing that, it’s a pain to have to close other windows that come up automatically. I’m guessing there’s a magic setting I can toggle somewhere?

1 Like

Forgiving history when opening the first window
#2

I figured it out. In Packages/User/Global.sublime-settings, the following lines got me what I want:

{ "hot_exit": false, "remember_open_files": false }

2 Likes

#3

Is it possible to change these setting from command line rather than editing the setting permanently in sublime?

For when I have 2 or 3 projects in sublime but want a new folder to open in sublime without those previous projects and don’t want the new project to overwrite sublime_session when I close the window. That way when I open sublimetext normally it will still have those 2 or 3 other projects?

It seems simple from the command line perspective. Just a option to ignore last session and don’t write session. But I don’t know how difficult it would be to implement in sublime if it doesn’t already exist.

Thanks

1 Like

#4

So, guys, any progress?

It really seems to be a tiny change — only add a command switch to ‘subl’ to ignore last session.

1 Like

#5

[quote=“constantius”]So, guys, any progress?

It really seems to be a tiny change — only add a command switch to ‘subl’ to ignore last session.[/quote]

+1

Such an option would make Sublime far more useful at the command-line for one-off file editing. Currently it’s a workflow PITA:

Eg,

I have Sublime set as my editor for git. Every time I “git commit -a”, Sublime opens with a bunch of tabs (and possibly windows).

Now,
Say I write my commit and then close with alt+f4, Git won’t commit because I have another sublime window open and it’s waiting for the process to quit, plus I’ve now broken my window collection from my last development session.

So I have to write my commit, then carefully save it, close the tab and then exit Sublime with File…Exit to keep my windows/projects as they were before. What a faff!

I’ve tried all kinds of workarounds for this, like loading a blank project with the cmdline etc., but none of them play nice. Blank projects have the annoying bug of launching a separate window, and randomly focusing it instead of the window with the file launched from the cmdline.

What we want here is a simple launch option that disables hot_exit, doesn’t load any session/projects, and launches sublime in its own process for one-off editing. This would be dead handy for command line editing, but also for other purposes too, like making sublime the editor launched by other apps.

Sublime is beautiful, but it’s doesn’t play nice for people wanting to launch from the command line for one-off editing. As a result, I usually fall back to vim or whatever for those jobs.

1 Like

#6

Hey guys, I’m posting just because I’m interested in this topic. I have the same issue. I’m looking into projects at the moment. I wonder if a project file could accomplish what we are looking for

1 Like

#7

+1 for me. I’m really confused how there are so many bugs surrounding projects and build systems. (I open a project file with subl Project.sublime-project and instead of opening that project it simply opens it in the currently open or last open project. Prime wtf.) Or, maybe it’s just a misunderstanding but if that’s the case where’s the documentation?

1 Like

#8

You running under tmux? If so, you need to install reattach-to-user-namespace and set an alias like:
alias subl=‘reattach-to-user-namespace /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl’

–project now works, it will load your project, or file, or whatever. This was frustrating me and I just figured it out a few minutes ago. Then I found this thread about my other gripe. I want the option to not load my previous session (as a command line flag, not as a global config)

+1

0 Likes

#9

HUGE +1

I use sublime as my default editor in linux, the fact that version 3 can elevate to root on the fly makes it damn comfy to use
and a switch telling subl to ignore session and just open passed path would be very nice

0 Likes

#10

Still nothing new on this? Would be great with a command line option.

0 Likes

#11

+1 but I guess “technical support” isn’t the right place to post this

0 Likes

#12

+1 This would be really useful, particularly for git commit workflows etc

0 Likes

#13

useful command (running Linux):

subl3 -wn "Enter File Here"

Also add to config:

{
    "close_windows_when_empty": true
}

Edit: Add Code Section and Added config fle

1 Like

#14

Step 1 : goto Preferences->settings
Step 2 : Now the setting file is open.Enter following lines
> “hot_exit”: false,

      "remember_open_files": false 

you done it.
:slight_smile:

1 Like

#15

not sure about the necro, but there is also a request for this functionality here:

0 Likes

#16

Go to Menu Bar > Preference > Settings. One the right hand side add the following two lines,

{
  "hot_exit": false,
  "remember_open_files": false
}

Here is a screenshot,

Now, sublime won’t reopen the last session.

1 Like

#17

I apologize for reviving such an old thread, but setting remember_open_files on true also disables saving the files in the recent list. I need to have the files in the recent list but not reopened on the next startup. Is that possible?

Thanks in advance.

0 Likes

#18

thanks, it helped.

0 Likes

#19

my hot_exit and remember_open_files are already set to false. Nevertheless, the freaking app still reopens all the tabs and windows I had open previously. They just keep stacking on top of each other.

EDIT: I set hot_exit to "disabled" instead of false like the README of the settings says to do. That seems to maybe have helped…Maybe.

EDIT 2: It did not help–old sessions (or parts of them) still (randomly?) kept reopening upon starting the app. Can’t replicate now that i was going to take a video of it, of course…

1 Like

#20

"hot_exit": false works identically to "hot_exit": "disabled".

0 Likes