Hardy Le Roux
Hardy Le Roux

Reputation: 1529

How to close all tabs with Sublime Text 2 without saving?

I use Sublime Text 2 for editing a lot of temporary files. I end up with lots of tabs open.

I want to close all open tabs without saving and without the "Do you want to save the changes you made to new file?" prompt showing and having to click on "Don't Save" for each tab.

Upvotes: 49

Views: 35555

Answers (8)

Dirk
Dirk

Reputation: 1

I had the same problem and wrote a plugin package for sublime to close all files without confirmation. It works via command palette and you can add key bindings too:

https://packagecontrol.io/packages/Close%20All%20without%20Confirmation

Upvotes: 0

Siva S
Siva S

Reputation: 772

Below worked for me in Mac OS

rm -rf  ~/Library/Application\ Support/Sublime\ Text\ 3/Local/ 

Upvotes: 1

theseventhsense
theseventhsense

Reputation: 137

Search for Session.sublime_session file in your /Library/Application\ Support/Sublime\ Text\ 3/Local/ folder.

Delete the file via the finder app.

Else execute

rm /Library/Application\ Support/Sublime\ Text\ 3/Local/

Upvotes: 3

You can remove the session data. In Windows, navigate to /your/sublime/install/Data/Local/ and remove any .sublime_session files. Kill sublime if it's open: press WindowsBtn+R and enter taskkill /F /IM sublime_text.exe Next time you open up Sublime, a single empty window will show.

Process is probably similar for other OS too.

Upvotes: 6

Retsam
Retsam

Reputation: 33389

If you're working in an environment with version control, it might actually be easier to leverage that to get the same effect:

  1. In your VCS, stash your changes, (or otherwise ensure that you have a clean working environment)

  2. In Sublime, hit Save All, then Close All.

  3. In your VCS, clear away all the changes you just made. (git reset --hard, in git)

There are some caveats (if you modified files that aren't in your VCS this won't work for them); but I found it a lot easier than messing with SublimeText settings.

Upvotes: 4

Enteleform
Enteleform

Reputation: 3823

TabsExtra gives you several additional tab closing options via the tab menu:

menu

dialog

Upvotes: 77

Dũng IT
Dũng IT

Reputation: 2999

My way is revert all files after to close all files:

View/Show Console and enter command:

len([v.run_command("revert") for v in window.views()])

Or Save after Close all files:

len([v.run_command("save") for v in window.views()])

Then go to File/Close All Files

I tested on Mac OS and Sublime Text 2. You can try other version and OS.

Hope help you to close all files.

Upvotes: 34

Julien Mazars
Julien Mazars

Reputation: 1192

Just found the solution !!! Better to share it on StackOverflow :

1) Go to preferences, Setting-Default enter image description here

2) Change the value of the 2 parameters "hot_exit" and "remember_open_files" to false enter image description here

3) Kill Sublime Text brutally with the Task Manager

4) Launch Sublime Text

Cheers !

Upvotes: 55

Related Questions