Allow Esc to clear file explorer selection

Use case or problem

There doesn’t seem to be a way to clear the current file explorer selection using the keyboard. i.e.,

  1. Pressing Shift+Up/Down lets you add several adjacent items to the selection.

  2. Subsequent movements using Up/Down change the focused file, but don’t seem to clear the selection from [1]. Clearing the selection is consistent with how file explorers typically work; however, by not clearing it, a non-continuous multi-selection is possible; so I think this should remain.

  3. Problem: There isn’t a way to select a different range of continuous files because the selection isn’t cleared [2].

Proposed solution

Allow pressing Esc to clear the multi-selection, if there is one. Pressing Esc currently seems to focus the open note? So,

  • With file explorer open, focused and a multi-selection present, pressing Esc should clear the current selection.
  • Otherwise, pressing Esc Should focus the open note, as it already does.
1 Like

Are you using the MetaBind plugin? Maybe this is relevant to you:

No it doesn’t. Pressing Esc exits the item navigation in Files. I think this is mostly accessability feature but currently it seems to focus scrolling in Files which isn’t very useful. Pressing Esc again should focus the editor. I tested that you can use space to open the selected item and this also clears you multi selection. You have to then focus Files again by running command Files: Show file explorer.

I agree that Esc should have better functionality in Files. It should either focus editor directly or clear multi selection if present. The clearing of multi selection is optional because you can do it quickly anyways using key sequence like SpaceF1. However when dealing with multi selection one might want to press Esc to focus editor tab group and then use tab group related navigation like Go to next tab. Multi selected items can be dragged into notes.

Just the core plugins, and I don’t intend to use any community plugins; but thanks, I’ll check it out!

I’m in the sandbox on Obsidian 1.8.9, and with file explorer focused a multi-selection present, pressing Space opens the last-selected file (clearing the selection), and pressing F1 opens some sort of help dialog. If you’re referring to pressing Space+F1 in sequence, to me that seems to open the last-selected file and the help dialog.

Either way, none of these simply clear the current selection, so that different range of files can then be selected. For example, doing this :point_down: requires using the mouse to reset the selection, or requires opening a note with Space and then focusing the file explorer again, AFAIK.

To me, Esc generally means escape from the current context into the parent context if there is one; i.e., Current context = multi-selection within file explorer? Escape to file explorer with no selection. Current = file explorer with no selection? Escape to the “main” content (e.g., a note, canvas, wherever the user was before they focused on file explorer). Current = settings view? Close settings view if there are no unsaved changes/warn about unsaved changes. etc. :person_tipping_hand:

So, if the user is already focused within file explorer and a multi-selection is present, pressing Esc to clear the selection is the most intuitive way to do it, IMO.

Yes. And you can open file explorer by Files: Show file explorer and you can bind F1 for this command.