Sublime Forum

Capitalise 'open' or 'close' in file dialogues, to reduce anxiety about overwriting

#1

When I mean to open a file in Sublime, and have >0 file(s) open in Sublime already, I worry sometimes that I have pressed the keyboard shortcut not for open but for save and am, thus, about to overwrite another file by accident. Now, I think Sublime would give me an overwrite prompt, but why not simply capitalise ‘open’ and (as the case may be) ‘save’ in the window title? Easy to do and it makes the program more usable.

0 Likes

#2

What do you mean by “overwrite” ?

0 Likes

#3

I mean replace, in this sense: file A overwrites/replaces file B when the contents of file B become the contents of file A.

0 Likes

#4

And what you mean by Capitalise ‘open’ or ‘close’ in file dialogues?

It is about writing it as Open and Close, instead of close and open?

Then why Capitalise ‘open’ or ‘close’ in file dialogues would reduce the anxiety about overwriting?

0 Likes

#5

By default, it’s Open and Save As (at least on Windows), I guess OP wants OPEN and SAVE AS, which IMO would be ugly, distracting and unprofessional, but there you go :wink:

0 Likes

#6

As Kingkeith says, I am suggesting the following. Within the string displayed by the ‘save as’ dialogue, and within the string displayed by the ‘open’ dialogue, the words ‘save’ and ‘open’, respectively, be rendered as follows: ‘OPEN’; ‘SAVE AS’. The point would be to be distracting, but in what would at least sometimes be a helpful way - in that the change would confirm to the user what s/he is doing. An alternative to the capitalisation would be italicisation (of, again, the whole word - not just of a letter and not of the whole string). Or perhaps, within the dialogue window, we could have one icon displayed for save and one for open.

0 Likes

#7

This is your own quirk you need to overcome. If CAPS were introduced into the UI to signpost every thing some individual somewhere fumbles with, then it would be a mess.

0 Likes

#8

Perhaps this a change that could be made that I would welcome and others would be happy with. I note, in that regard, that Microsoft Office - for all its horrible flaws - has ‘Save as’ and ‘Open’ in rather large type in the relevant windows.

0 Likes

#9

Just for the record, Sublime does indeed ask you if you’re sure before overwriting a file on save, but it never asks you if you’re sure you want to open a file. I don’t see the logic in how existing text being bigger makes Sublime more usable, but I also very rarely use the Open dialog so I’m not really in the target audience either.

Just out of curiosity, have you remapped your default key bindings to make the Open and Save commands be on adjacent keys?

0 Likes

#10

I should (indeed) have said why I have a need for the feature. It is not because I’ve mapped the save and open keys to physical keys that are near each other. Rather, I’ve been needing to ensure that (1) I open a new file rather than (2) save changes that I have made to an existing, already opened file. 2 would not give an overwrite warning.

On reflection, perhaps my request is silly - given (i) the narrowness (and indeed, probably, avoidability) of my use case, (ii) the visual ugliness that implementing my suggestion could cause. I had not appreciated i and ii.

0 Likes

#11

Ahh, I see. Yeah, Sublime won’t directly prompt you to verify that you want to save a file that already has a name, but you can get that sort of functionality with a plugin.

For example, this implements a prompt_save command that will ask you if you’re sure before saving a file that already exists (because you’ve previously opened it) but will automatically run the save command if you’ve created a new file and you’re saving it for the first time:

import sublime
import sublime_plugin


class PromptSaveCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        if (self.view.file_name() is None or
            sublime.ok_cancel_dialog("Are you sure you want to save?")):
            sublime.set_timeout(lambda: self.view.run_command("save"), 0)

If you use that and override the key binding for the save key to run prompt_save instead of save, you might be closer to what you want/need to do.

This could also be easily enhanced so that you could for example toggle a “protected” state on the file so that it only prompts you for files that you want this protection for, as well.

2 Likes