scambier / obsidian-omnisearch

A search engine that "just works" for Obsidian. Supports OCR and PDF indexing.
GNU General Public License v3.0
1.24k stars 65 forks source link

[Feature request] Whether to open a new panel if the search result is in the current file #320

Open yan42685 opened 12 months ago

yan42685 commented 12 months ago

Is your feature request related to a problem? Please describe.

I hope that during searches, if the search result is in the current file, it shouldn't open a new pane, but if the result is in another file, then it should open a new panel. Right now, there's only one option that can be set, which is Open in new pane and it applies to all search results.

Describe the solution you'd like It would be nice if there are two setting options:

  1. Whether to open a new panel if the search result is in the current file.
  2. Whether to open a new panel if the search result is in another file.

Additionally, these options will be applied to both commands In-file Search and Vault Search.

Describe alternatives you've considered Provide only one setting, whether to open a new panel if the search result is in another file. Because if the search result is in the current file, simply jumping to the cursor position should be a good default behavior.

scambier commented 12 months ago

Because if the search result is in the current file, simply jumping to the cursor position should be a good default behavior.

Though I agree with you and actually would like this to be Obsidian's default behavior, this is outside of Omnisearch's scope.

However I made another small plugin that you can enable to get this behavior. It's not perfect but works well with Omnisearch: https://github.com/scambier/obsidian-no-dupe-leaves

yan42685 commented 12 months ago

Thank you for replying. I tried using the plugin obsidian-no-dupe-leaves that you made and the recommended obsidian-mononote, but I found that they address the issue of Obsidian's own link navigation behavior: if the link being navigated to is already open in a tab, it won't open a duplicate tab.

However, this doesn't solve my problem. When Open in new pane is turned on, both plugins still can't prevent Omnisearch from opening another duplicate tab. What I'm hoping for is that when Omnisearch navigates to search results, if the result is different from the current file, it opens a new tab; otherwise, it just moves the cursor within the file.

If I don't turn on Open in new pane, Omnisearch won't open a new tab for a different file. Is there any workaround for this?

scambier commented 12 months ago

Ok I misunderstood your request.

So what you want is either switch to an existing note if it's already open, or open a new tab.

yan42685 commented 12 months ago

Yes, it is.