IDE style navigation (tab reuse on link opening, tab management)

MOD-EDIT: This is a reorganized FR

Currently, Obsidian uses a Browser-style navigation system.
You click on link, it opens it in that tab.

An alternative approach is to follow IDEs (Integrated develop environment/Code Editors).

IDEs generally don’t navigate within a tab.
You click on a link and it either:

  1. Moves the focus to a tab where the target was already open or
  2. A new tab with the target is opened.

IDEs navigate in the current tab only if the target of the link is in current tab itself.

30 Likes

Use case or problem

Let’s say I have 2 open notes, Parent and Child.
Parent has a link to Child.
If I click on [[Child]] from Parent and unless Parent is pinned, Obsidian will re-open Child.

Now I have 2 open copies of Child, and 0 of Parent.

Proposed solution

If the note Child is already open, just put the focus on it, even if Parent is not pinned. If the user really wants to open another copy of Child, they can just middle click on the link.

Current workaround (optional)

I quickly wrote a hacky monkey-patch to get around this: GitHub - scambier/obsidian-no-dupe-leaves: Automatically switch the focus to open notes instead of reopening them

Related feature requests (optional)

None.

27 Likes

This would be nice! :slightly_smiling_face:

2 Likes

I need that. I wonder why not more would want this behavior. Of course there still should be the possibility to open the same note in a new pane by right-click-menu or shortcut.

But as a default I really want to simply focus the already open note!

2 Likes

This is also the behavior I expected when I first started using Obsidian. Thanks for requesting!

5 Likes

I encounter this issue almost daily. It is one of those annoyances that I wish would go away but don’t take any steps to fix. I end up hitting my keyboard shortcut to “Navigate back” to see the Parent again. Thanks for writing up the problem and requesting the feature. It would be most appreciated if devs could provide this feature.

3 Likes

This is now a community plugin: Plugins - Obsidian

9 Likes

I’ve just installed the “No Dup Leaves” plugin and it is creates exactly the Obsidian behavior I’d prefer. Thanks scambier for making this happen now via your plugin and I’ll add my vote to this Obsidian feature request.

1 Like

Thanks for this! That duplication has really bothered me.

It’s worth noting that you can still create a second instance of a note by doing a “open current pane in new window”, which gives you a pop-out window. I can see that being useful sometimes.

EDIT This was in response to scambier post.

We did some internal testing at some point about this. I understand some people like it, but the behavior is a bit jarring because sometimes you navigate in this tab and other times you move the focus somewhere else. This is also not how browsers work (nor code editors).

Another workflow trying to tackle the same problem is “reuse tab when opening in new tab”

3 Likes

Some code editors, like VSCode, have this behavior, and I find it jarring :smiley: . Others like Jetbrains put the focus on the file if it’s already open. I agree that browsers work like that too, but a browser’s UI is different, and so is its usage :man_shrugging:

It would be nice if users could choose which behavior suits them best in Obsidian’s settings. Though from what I’ve gathered, I understand it is easier said than done.

2 Likes

Yes, some code editors have some form of reuse. But the crucial difference is that code editors generally don’t navigate within a tab. You click on something and it either

  1. moves the focus to a tab where the target was already open or
  2. a new tab with the target is opened.

There’s no opening/navigating a link in this tab (unless the target is in the same tab).

The way code editors and browsers handle this workflow is substantially different and hybrid approach is jarring.

1 Like

With my current way of working, I end up with tons of open tabs of the same document, so I’d be really pleased to see this functionality added, perhaps as a configurable option as I appreciate that is may be down to personal preference.

But the crucial difference is that code editors don’t navigate within tab .

This isn’t entirely true, CTRL + clicking in VSCode on a function will navigate to the functions definition in the current tab. I personally find this very intuitive and think it would be a good fit for Obsidian, whose experience should be closer to that of an editor than to that of a browser, in my opinion.

Code_hMHD50lXhm

Had Match been defined in a separate file which was already open, VSCode would have reused the tab and put focus on the Match definition. I think this behaviour should be matched in Obsidian, though gated behind the CTRL key similarly to the VSCode (and many other editors’) behaviour.

If an implementation already exists internally, perhaps it could be trialed on Insiders while gated behind a configuration flag?

2 Likes

As someone who prefers reading mode over live preview, this feature is gonna mess things up for me. I often open 2 panes of the same note, one in source mode and the other in reading mode. I then link the two panes so that they will scroll down together when I scroll down.

Sometimes I have to work on different parts of the same note, so having two panes is essential, especially when the note is quite long.

There are already plugins doing this, so I don’t see the need for it to be in core.

This is because you are clicking on something that is on the same file. What happens if you click on something that is on a different file? Is it opining in that tab or is it opening a new tab?

The point is this, the way browsers and IDEs handle this is very different and it’s either one or the other, because hybrid approach look odd.

This is because you are clicking on something that is on the same file. What happens if you click on something that is on a different file? Is it opining in that tab or is it opening a new tab?

Perhaps I misunderstood the original post – if clicking on something that is in a different file the editor will reuse an existing tab of that file and put the focus on the target. If no existing tab is found, a new one will be created. A duplicate tab is never produced.

The point is this, the way browsers and IDEs handle this is very different and it’s either one or the other, because hybrid approach look odd.

I appreciate this, but at least for my use case (and @scambier’s, it appears), the IDE approach is a much better user experience. I think both can reasonably be accommodated by introducing a configuration flag. Humbly I think this could reasonably be a core functionality and not something that requires resorting to a 3rd party plugin.

Additionally it seems implementing this in a consistent way is not easily done with a 3rd party plugin using the current API. Taken from the no duped leaves plugin description:

:warning: Word of warning :warning: This plugin modifies the default behavior of Obsidian.

Internally, it overwrites the public function openLinkText(), which is called when you click on a link in a note. This also affects other plugins that use this function - like Omnisearch -, but does not work on core features like the File Explorer.

3 Likes

I was re-reading this, and I think there is some misunderstanding.

My hacky plugin tries to focus on one thing: not creating a new tab with a file, if that file is already opened elsewhere. Because I never need 2 different tabs with the same note. Like, ever. And even if I do, i can still ctrl+click the link. It does it imperfectly simply because I can’t properly patch the lower-level API (and risk introduce bugs).

What you describe in the post I respond to is a behavior I’m totally ok with. I hate it when opening a note (through a link, filename, or modal) replaces the active tab.

Obsidian is powerful enough to accommodate different people’s need because it’s open and not opinionated, but I always found its design choices about navigation kinda weird. I’m not asking to revamp the whole thing because it’s certainly fine for most users, but some settings like “switch to a note if it’s already open instead of opening it a second time” and “always open notes in a new tab” would be nice.

4 Likes

I understand you would like an IDE-like behavior (as opposed to a browser), we are not sure we wanna go there. We’ll see in the future. I reorganized this FR to make it clearer.

1 Like

It would make most sense to me for IDE-style navigation when in editing mode and browser-style navigation when in reading mode.

3 Likes

I like this idea very much. I don’t know how much of you user base uses IDEs, but I spend many hours in JetBrains IDEs and for me Obsidian is basically a note-taking IDE.

5 Likes