SaveThemAll is a Sublime Text plugin that automatically saves unsaved buffers (files) to organized, project-based directories with timestamped names. It simplifies and speed-up file management by ensuring unsaved work is preserved in a structured, predictable way.
As a Network Engineer and developer, I often open multiple new tabs daily—quick notes, experiments, config checks, scratch code. Over time, it becomes impossible to remember which files are worth keeping and which are just junk. Manually saving and organizing them is tedious and breaks focus.
SaveThemAll was built to solve this: It captures and preserves unsaved buffers automatically, storing them in a clear, project-based structure with zero manual effort. Now I never lose valuable notes, and I don’t waste time closing or saving temporary files one by one.
And because all text buffers are saved—even the ones you forgot about—you can now search for and find that important idea or snippet days later. It’s probably sitting in the unsorted
folder, safely preserved.
- Automatically names and saves unsaved buffers using a
dateclock-uuid
format. - Organizes files by project (
private
,work
,unsorted
) and date (year/month/day
). - Saves unsaved buffers in the active window or all open windows, depending on the command.
- Configurable via
SaveThemAll.sublime-settings
, with support for the%username%
variable for portable paths. - Provides status bar feedback for save operations and errors.
- Skips empty or read-only buffers to avoid unnecessary saves.
- Sublime Text 3 or 4.
- macOS, Windows, or Linux (paths with
%username%
are supported cross-platform).
- Sublime Text 3 (Build 3000 and above) and Sublime Text 4.
- Tested on macOS, Windows, and Linux. The
%username%
variable is resolved cross-platform usingos.path.expanduser('~')
and fallbacks.
- Open Sublime Text.
- Press
Ctrl+Shift+P
(Windows/Linux) orCmd+Shift+P
(macOS) to open the Command Palette. - Type
Package Control: Install Package
and press Enter. - Search for
SaveThemAll
and select it to install. - Restart Sublime Text if prompted.
- Save the Plugin Files
CopySaveThemAll.py
andSaveThemAll.sublime-settings
to your Sublime TextPackages/User
directory:- macOS:
~/Library/Application Support/Sublime Text/Packages/User
- Windows:
%APPDATA%\Sublime Text\Packages\User
- macOS:
- Restart Sublime Text
Restart Sublime Text to load the plugin.
-
Create a New File
Open a new file (Ctrl+N
on Windows orSuper+N
on macOS). The plugin assigns a temporary name (e.g.,2025-05-01_123456-abcd1234.txt
). -
Save Unsaved Buffers
Use the Command Palette (Ctrl+Shift+P
on Windows orSuper+Shift+P
on macOS) to run:Save Temporary Buffers
: Saves all unsaved buffers in the active window.Save All Buffers
: Saves all unsaved buffers across all open windows. Files are saved to a project-based directory, such as:- macOS:
~/Documents/sublime-project-autosaves/unsorted/2025/05/01/
- Windows:
C:\Users\%username%\Documents\sublime-project-autosaves\unsorted\2025\05\01\
-
Check Feedback
The status bar shows messages like"Saved 2 temporary buffer(s) in active window"
or"Saved 3 unsaved buffer(s) across 2 window(s)"
, or error details if something goes wrong. -
Project-Based Organization
Files are saved to directories based on their project context (private
,work
,unsorted
) as determined by their file path. Unsaved files default to theunsorted
directory. -
Example
- Open multiple Sublime Text windows, each with several unsaved tabs (e.g., notes in one window, code snippets in another).
- To save only the active window’s unsaved tabs, press
Super+Opt+S
(macOS) orCtrl+Alt+S
(Windows). - To save all unsaved tabs across all windows, press
Super+Opt+Shift+S
(macOS) orCtrl+Alt+Shift+S
(Windows). - Files are saved, e.g., to
/Users/johndoe/Documents/sublime-project-autosaves/unsorted/2025/05/01/2025-05-01_123456-abcd1234.txt
. - Later, search your
unsorted
folder to find the notes using your OS’s search tools (e.g., Spotlight on macOS or File Explorer on Windows).
Edit SaveThemAll.sublime-settings
in your Packages/User
directory.
-
base_dir
Root directory for saved files.- Default:
- macOS:
~/Documents/sublime-project-autosaves
- Windows:
C:\Users\%username%\Documents\sublime-project-autosaves
- macOS:
- Example:
- macOS:
"base_dir": "/Users/%username%/Documents/my-autosaves"
- Windows:
"base_dir": "C:\\Users\\%username%\\Documents\\my-autosaves"
- macOS:
- Default:
-
default_extension
Default file extension for saved files.- Default:
.txt
- Example:
"default_extension": ".md"
- Default:
-
project_mappings
Maps parts of a file path to named save directories.- Default:
[ {"match": "private", "path": "~/Documents/sublime-project-autosaves/private"}, {"match": "work", "path": "~/Documents/sublime-project-autosaves/work"}, {"match": "unsorted", "path": "~/Documents/sublime-project-autosaves/unsorted"} ]
- Example:
[ {"match": "personal", "path": "~/Documents/sublime-project-autosaves/personal"}, {"match": "projects", "path": "~/Documents/sublime-project-autosaves/projects"} ]
- Notes:
match
is case-sensitive and supports partial matches (e.g.,work
matcheswork-project
).path
supports%username%
, which expands to the current user’s username (e.g.,johndoe
).- The first matching rule determines the save path; otherwise,
base_dir/unsorted
is used.
- Default:
Add to Default.sublime-keymap
in Packages/User
.
[
{"keys": ["super+option+s"], "command": "save_temporary_buffers"},
{"keys": ["super+option+shift+s"], "command": "save_all_buffers"}
]
[
{"keys": ["ctrl+alt+s"], "command": "save_temporary_buffers"},
{"keys": ["ctrl+alt+shift+s"], "command": "save_all_buffers"}
]
The plugin provides two commands to save unsaved buffers, accessible via the Command Palette (Ctrl+Shift+P
on Windows or Super+Shift+P
on macOS) or custom keybindings (see above).
-
SaveTemporaryBuffersCommand
- Purpose: Saves all unsaved buffers (files without a file name) in the active window.
- Behavior: For each unsaved buffer in the active window, the plugin generates a unique filename in the format
YYYY-MM-DD_HHMMSS-uuid8.ext
(e.g.,2025-05-01_123456-abcd1234.txt
, whereext
is set bydefault_extension
in settings). Files are saved to a directory determined by the project context (private
,work
, orunsorted
) and organized by date (year/month/day
). - Use Case: Ideal for quickly saving temporary buffers in the current window, such as notes or code snippets, without affecting other open windows.
- Trigger: Run via the Command Palette by selecting
Save Temporary Buffers
or use the keybinding (Super+Opt+S
on macOS orCtrl+Alt+S
on Windows). - Feedback: The status bar shows the number of buffers saved (e.g., "Saved 3 temporary buffer(s) in active window") or "No unsaved buffers to save in active window" if none exist. Errors (e.g., permission issues) are displayed in the status bar.
- Notes: Skips empty or read-only buffers and does not affect files with existing names.
-
SaveAllBuffersCommand
- Purpose: Saves all unsaved buffers across all open windows.
- Behavior: Processes all unsaved buffers in every open window, applying the same
dateclock-uuid
naming convention and saving to project-based, date-organized directories. It does not save files that already have a file name. - Use Case: Useful for saving all temporary buffers across multiple projects or windows, ensuring no unsaved work is lost when working with multiple Sublime Text instances.
- Trigger: Run via the Command Palette by selecting
Save All Buffers
or use the keybinding (Super+Opt+Shift+S
on macOS orCtrl+Alt+Shift+S
on Windows). - Feedback: The status bar shows the number of buffers saved (e.g., "Saved 5 unsaved buffer(s) across 2 window(s)") or "No unsaved buffers to save across all windows" if none exist. Errors are displayed in the status bar.
- Notes: Skips empty or read-only buffers and does not affect files with existing names.
Both commands ensure that only unsaved buffers are processed, preserving the integrity of named files. They integrate with the plugin’s configuration, using settings like base_dir
, default_extension
, and project_mappings
to determine save locations.
- Naming:
YYYY-MM-DD_HHMMSS-uuid8.ext
(e.g.,2025-05-01_123456-abcd1234.txt
) - Scope: Unsaved buffers in the active window (
SaveTemporaryBuffersCommand
) or all open windows (SaveAllBuffersCommand
). - Structure:
base_dir/ └── project/ └── YYYY/ └── MM/ └── DD/
- Error Handling: Errors are shown in the status bar; safe defaults are used.
- Plugin not loading:
- Ensure
SaveThemAll.py
andSaveThemAll.sublime-settings
are inPackages/User
(e.g.,~/Library/Application Support/Sublime Text/Packages/User
on macOS). - Open the Sublime Text console (
Ctrl+`` or
Super+``) and check for errors related toSaveThemAll
. - Add
print("SaveThemAll plugin is loading...")
at the top ofSaveThemAll.py
to verify loading. - Restart Sublime Text after moving files or making changes.
- Ensure
- Permission denied errors:
- If you see errors like
[Errno 13] Permission denied: '/Users/root'
, the%username%
variable may not be expanding correctly. - Verify that
base_dir
inSaveThemAll.sublime-settings
uses a valid path (e.g.,/Users/%username%/Documents/sublime-project-autosaves
). - Check write permissions for the target directory:
mkdir -p ~/Documents/sublime-project-autosaves/unsorted chmod u+rwx ~/Documents/sublime-project-autosaves
- Ensure Sublime Text is running as your user (e.g.,
johndoe
), notroot
. Check the process:ps aux | grep Sublime
- If
os.getlogin()
returnsroot
, ensureSaveThemAll.py
usesos.path.expanduser('~')
for username resolution.
- If you see errors like
- Files not saving:
- Verify write permissions for
base_dir
(e.g.,/Users/johndoe/Documents/sublime-project-autosaves
). - Ensure
%username%
resolves correctly (e.g.,/Users/johndoe/...
). - Check for errors in the console when running commands.
- Verify write permissions for
- Wrong directory:
- Verify
project_mappings
inSaveThemAll.sublime-settings
. Thematch
field should align with directory names in your file paths.
- Verify
- Keybindings not working:
- Confirm the keymap file is in
Packages/User/Default.sublime-keymap
and contains valid JSON. - Check for conflicts with other keybindings in the Sublime Text console.
- Confirm the keymap file is in
- General issues:
- Clear the Sublime Text cache:
rm -rf ~/Library/Application Support/Sublime Text/Cache/*
. - Ensure you’re using Sublime Text 3 or 4 (check via
Sublime Text > About Sublime Text
). - Test with a minimal plugin to confirm the Python environment:
# Packages/User/TestPlugin.py import sublime_plugin print("TestPlugin is loading...")
- Clear the Sublime Text cache:
Contributions are welcome! Please submit issues or pull requests on the GitHub repository for bug reports, feature requests, or improvements.
This plugin is licensed under the MIT License.
%username%
is automatically replaced by the current system username (e.g.,johndoe
on macOS or Windows).