Sublime - Close file without saving

Viewed 5151

This has been bothering me for ages.

In Sublime, I know cmd+W will close a file but how do I toggle to the "Don't Save" option if I just want to close a file without saving?

enter image description here

5 Answers

For mac, try:

  1. quit the application (CMD + q)
  2. remove the local sublime session with:

rm ~/Library/Application\ Support/Sublime\ Text\ 3/Local/Session.sublime_session

  1. restart Sublime

It seems to me that the accepted answer doesn't quite address the question, but provides a workaround.

Consider the following excellent answer, which allows closing a file without the dialogue being displayed: https://superuser.com/a/1188135/73736.

In addition to the accepted answer / workaround, the default MacOS shortcut cmd+delete works fine in the dialogue!

Alternatively, if you have System Prefs > Keyboard > Shortcuts: Full Keyboard Access "All controls" selected, then "Don't Save" will be have an outline around it, and can be selected by hitting space, whilst enter triggers "Save".

A hack would be to press 'close other tabs' and click continuously on 'Close without Saving' as mouse pointer will always be at same location.

Will take some seconds.

Ubuntu Users:

In short: Ctrl+W > Alt (hold for 1s) > W

Longer version: Ctrl+W will attempt to close the file and brings up this prompt when file has unsaved changes.

Ubuntu - Sublime close prompt

In order to Close Without Saving just tap and hold the Alt key for a second, underlines appear on one character of all 3 options and hit W to close without saving. Other options can be accessed with C and S as in screenshot.

Related