Sublime Text: Forget Last Opened Files
Are you tired of Sublime Text opening the same files every time you launch it? Do you wish to have a clean slate each time you start your text editor? If so, you’ve come to the right place. In this article, I will guide you through various methods to forget the last opened files in Sublime Text, ensuring a fresh start every time you open the application.
Understanding the Issue
Sublime Text, being a powerful text editor, stores the list of last opened files in its session file. This file is stored in the user’s home directory and is used to restore the previous session when the editor is launched. However, this feature can be quite annoying if you want to start fresh each time.
Method 1: Clearing the Session File
The simplest way to forget the last opened files is to clear the session file. Here’s how you can do it:
- Close Sublime Text if it’s currently running.
- Open your user’s home directory. On Windows, press `Win + R`, type `%APPDATA%`, and press Enter. On macOS and Linux, open the home directory directly.
- Locate the `Sublime Text 3` folder (or the version you are using) and open it.
- Find the `Sessions` folder and open it.
- Delete the `Default.sublime-session` file. This file contains the list of last opened files.
After deleting the session file, the next time you open Sublime Text, it will not restore the previous session and will start with a clean slate.
Method 2: Disabling Session Restore
Another way to forget the last opened files is to disable session restore in Sublime Text’s settings. Here’s how you can do it:
- Open Sublime Text.
- Go to `Preferences` > `Settings` (or press `Ctrl + ,` on Windows/Linux, or `Cmd + ,` on macOS).
- Press `Ctrl + Shift + P` (or `Cmd + Shift + P` on macOS) to open the Command Palette.
- Search for `Open Settings (All)` and select it.
- Scroll down to the `Session` section and find the line `session_save`: change its value from `true` to `false`.
- Save the settings and restart Sublime Text.
By disabling session restore, Sublime Text will not save or restore the session, effectively forgetting the last opened files.
Method 3: Using a Plugin
Sublime Text has a vast collection of plugins that can be used to customize the editor’s behavior. One such plugin is `Session Manager`, which allows you to manage and save multiple sessions. Here’s how you can use it to forget the last opened files:
- Install the `Session Manager` plugin from the Sublime Text Package Manager.
- Open the `Session Manager` panel by pressing `Ctrl + Shift + P` (or `Cmd + Shift + P` on macOS) and typing `Session Manager`.
- Select `Save Session` to save the current session.
- Close Sublime Text.
- Next time you open Sublime Text, the `Session Manager` panel will be available, allowing you to load the saved session instead of the last opened files.
This method provides you with the flexibility to save and manage multiple sessions, while still forgetting the last opened files.
Conclusion
Forgetting the last opened files in Sublime Text can be achieved through various methods, such as clearing the session file, disabling session restore, or using a plugin like `Session Manager`. Choose the method that suits your needs and enjoy a fresh start every time you open Sublime Text.