Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yan42685 opened this issue Nov 26, 2023 · 4 comments

Comments

@yan42685
Copy link

yan42685 commented Nov 26, 2023

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.

@yan42685 yan42685 changed the title [Feature request] [Feature request] Whether to open a new panel if the search result is in the current file Nov 26, 2023
@scambier
Copy link
Owner

scambier commented Nov 26, 2023

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
Copy link
Author

yan42685 commented Nov 26, 2023

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
Copy link
Owner

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.

@scambier scambier reopened this Nov 26, 2023
@yan42685
Copy link
Author

Yes, it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants