Sublime Forum

Save All except new files?

#1

I often use new, unsaved files to jot down temporary notes, terminal snippets, test results, and so on. These are temporary: I don’t plan to ever save them.

This is frustrating when I do operations that impact multiple files. The most common problem is that I do a Replace All, which opens and modifies dozens of files. I want to Save All, to commit that change to disk, but that requires me to save lots of temporary files, which I don’t want to do. So I end up having to go tab by tab, saving files.

Possible improvements:

(1) I could skip saving a new file during Save All, instead of choosing between saving it or cancelling (which cancels the entire Save All).
(2) I could explicitly request “Save All except new”. I would use this a lot.
(3) Other?

Something related happens with closing tabs. I would like to be able to Close Tabs To Right and have it close everything except new files.

Thanks very much, and thanks for Sublime Text, which I have been using for about a decade now.

0 Likes

#2

The post linked below contains a plugin that implements a version of the save_all command that will only save named files; that might do what you want as far as the saving goes. Probably a plugin would also be possible for your related Close issue as well.

Note however that although the post mentions that the event listener will make key bindings and the menu entry for Save All automatically trigger the new command, that won’t work if you use Save All from the command palette; the appropriate event for detecting a command is being executed isn’t raised for commands launched from the command palette.

1 Like

#3

Hurray! That works like a charm. Just made my life SO much better.

Next time the Close issue starts bugging me, I’ll see about writing a plugin for it as well, and posting it here.

1 Like