Keyboard shortcut to collapse all folders

Use case or problem

I have many topics (folders). When expanded, they already take more than a screen. I use almost all of the folders on a semi-regular basis.

So, either they are mostly expanded, resulting in the need to scroll, slower navigation and less minimalistic view, or I can click the Collapse all folders button. The latter is somewhat distracting if done often, and if not, folders will be in different places. The navigation could be even more seamless if users could locate folders by places and not by reading their names.

Proposed solution

There already exists an interface button to collapse all folders. I’d like a keyboard shortcut option for triggering that feature.

(Extra solutions:
2. Option to collapse all folders on program start
3. Add shortcut options for ~all features by default. If needed, make it generally easier to implement keyboard shortcuts)

Current workaround (optional)

I scroll or use the interface button.

Related feature requests (optional)

4 Likes

Alternatively, you can simply press your hotkey for Files: Reveal current file in navigation, then tap the left arrow key until all is collapsed. I had long understood this functionality in the Windows Explorer. But, because I had become accustomed to arrow key navigation not being possible in Obsidian, it took me a while to get used to being able to navigate with arrows.

In many ways, in the Obsidian File Explorer, I find using the left arrow (collapse) and right arrow (expand) preferable to a Collapse or Expand all hotkey (if it existed) simply because, for a large vault, the expand operation takes a while to complete.

Anyways, if you weren’t already aware of this, I hope you find it very helpful. Good luck!


As a side note, you may find this feature request useful. Modifiers/clicks/special behavior section within Hotkey editor. I believe that there are many time saving tricks (like the one explained above) in Obsidian that could be revealed in such a way.

2 Likes

Thank you for the idea!
I set up Ctrl+> as the shortcut, so the full current folder collapsing can be done with one hand.

(Still interested in the original shortcut.)

1 Like

I set up Ctrl+D as the hotkey for the Files: Reveal current fil in navigation option. But, when I use it the focus remains within the text file. Meaning I have to click the file in the file explorer before I can use the left and right arrows to collapse and expand. Is this expanded or is there something I can do to switch focus from the text file to the file explorer sidebar when I use the Ctrl+D hotkey?