How fold/collapse search results

The forum post https://forum.obsidian.md/t/collapse-search-results/1527 says that when viewing search results, providing the ability to fold/collapse search results was implemented 2 years ago.

There is nothing in the help about this that I can find. The search results appear collapsed, but how can I fold them automatically?

To have search results collapsed by default, first expand the Search settings, then click “Collapse results”

image

1 Like

Is there a way to configure a hotkey to toggle this setting? Not sure if something changed recently but it seems that my search results are always expanded by default, which I prefer not to see. A hotkey to collapse them would at least be more convenient than 3 extra clicks every time… (of course even better than that would be if it remembered its previous toggle status)

You can mod-click (command on macOS/ctrl on win/linux) on a collapse arrow to have all the results collapsed at once.

1 Like

Thanks @liam - but I am curious whether something changed recently (feels like it did) that is causing the search results to always default to “expanded”.

For now I wrote this ridiculous hack that I fire every 15 minutes on a cron, but seems quite silly

JSON=/path/to/vault/.obsidian/workspace.json
jq 'walk(if type == "object" and has("collapseAll") then .collapseAll = true else . end)' "$JSON" |
sponge "$JSON"

If you think there’s a bug, I suggest filing a separate bug report. Will be easier to offer help since I’m not sure what version of Obsidian you’re on.

If you’re able to reproduce the issue reliably, let me know; I’ll investigate if the setting isn’t being properly saved.

I don’t know if it’s a full blown bug. I am using 1.7.2

The setting seems to not be sticking. But it’s anecdotal. Let’s see if anyone else chimes in.

Others will be more likely to chime in to a bug report; its less likely that users are going to find this thread.

Ok, well let me see if I can come up with a repro.

I thought there was an update in the past couple years that allowed you to expand/collapse individual files’ context via the keyboard, i.e. shift+arrowUp/arrowDown, and it’s also my suspicion that we’ve lost this functionality. Currently there seems to be no way to expand/collapse search results using the keyboard. I’m happy to file a bug report, unless I’m mistaken and this functionality never existed?

Anecdotally, I can also say a few minutes ago I was able to key down to a result and simply hit the leftArrow key and it collapsed, and then I reloaded the app and the left/right arrow keys are not doing anything again.

I posted a followup bugreport as this issue continues to bug me even as of 1.7.7.

Oh my god I’ve been needing a toggling shortcut for years.
Now if I can only get a keyboard shortcut, it’d be perfect.