How do I open a file that's open in one pane again in another?

I would like to have the file open in more than one pane so that I can see two different parts of the file at the same time. This is easy to do by creating a new pane, but I can't seem to figure out how to do it (if it can be done) with existing panes -- that is, to open a file in an existing pane while it's already open in another pane.

In previous versions of IntelliJ IDEA (maybe 6 or before), opening a file in more than one pane was easy - simply open the file when the active pane doesn't already have the file open. However, in the current version, when I try to open a file that's already open in another pane, IntelliJ will automatically switch to the one that's already open instead of opening it again.

I know that it is technically possible for the current version of IntelliJ to have a file open in more than one pane. This can be accomplished by selecting "split vertically" or "split horizontally"; the current pane splits and the file that was active is now open in the previous and the new pane. However, I would like to be able to open a file more than once in panes that already exist. For example, namely, I pretty much always have two panes open (split vertically). With file foo.java open in left pane (and bar.java open in the right pane), I would like to open another foo.java tab in the right pane (without creating another split or having to close any other tabs/panes). How can I do this, if it is possible? (If not, anyone know why?)

To me, the ideal solution would be to have an "Allow a file to be opened in mulitple panes" option in Editor Settings. Then, if I explicitly open a file (viz., open it via the Project Tool Window, or Go To Class (CTRL-N)), it would then open the file (again) in the active pane (or go to the open file if it's already open in the active pane). Jumping to source (via, say, Go To Declaration) would/could still jump to the already-open file in whatever pane it is open in.

Thanks for the help,
~Robert


version: 8.0.1
platform(s): Windows XP and Mac OSX
additional keywords: multiple multi pane panes window windows tab tabs once twice

Edited message for clarity. -Robert

12 comments
Comment actions Permalink

I remember using this feature years ago and I still miss it. It was
useful to have a file open in multiple panes. I think the current
(deteriorated) split pane behaviour has been around since IDEA 7.

--
Esko Luontola
www.orfjackal.net

0
Comment actions Permalink

1) Right click in window that you want to have in two panes
2) Select Window->slipt horizontally
Now file is in two panes

-Rob

-1
Comment actions Permalink

Rob,

I'd like to be able to open the file again without opening a new pane.

I always have multiple tabs open in two panes (split vertically). A file that I have open in one pane I'd like to also open in the other existing pane (without creating a new pane, nor closing other tabs).

~Robert

0
Comment actions Permalink

Very clearly written question. I need the same thing and have asked for a solution on stackoverflow.

http://stackoverflow.com/questions/1846565/how-to-create-two-editor-windows-for-the-same-file

1
Comment actions Permalink

The correct tracker issue for this problem would be http://youtrack.jetbrains.net/issue/IDEA-34593 . Please Watch/Vote.

1
Comment actions Permalink

While the above IDEA-34593 was ultimately fixed, there's a lingering but extremely irritating UX issue with how files are opened in a different pane ("group") then the focused one when they are already open. Please vote if you'd like to see that changed. 

0
Comment actions Permalink

8 years later... the situation is the same.

There is no way to open an already opened file in an existing split with the keyboard...

0
Comment actions Permalink

Does anyone have a solution for this? I have a multiple monitor setup and after opening a file with cmd+shft+O my cursor often jumps to a different monitor. Hunting down where the file was opened is a pretty significant distraction to my workflow.

Thanks!

Just to add a workaround. Behavior is correct if the file was previously opened with "split-window" and exists as a tab in the current pane. My workaround currently is the following: When I open a file and the cursor jumps to an undesired open pane, I open the file again with split-window and drag the newly created tab into the pane that I wanted to originally open the file in. It's annoying but happens less often as my common files get instances in each pane. Is it possible to automate this workaround?

0
Comment actions Permalink

Brandon, I think https://youtrack.jetbrains.com/issue/IDEA-67559 is related to this issue - you might want to vote on it.

In one of the tickets linked to it as related, https://youtrack.jetbrains.com/issue/IDEA-121003, someone (Gary Clayburg) was talking about creating a plugin. That could probably address the issue.

0
Comment actions Permalink

The option you are looking for is "Open in Opposite Group". It doesn't have a keyboard shortcut assigned to it by default. You can assign one through keymap settings. If you don't use it often enough to require a keyboard shortcut search for the action and execute it from there:

 

put your cursor in the file you want to open in the other side of the split editor->cmd-shift-a->type "open opp"->select "open in opposite group"

 

A second way to do it:

  1. Put the cursor in the editor you want the class to display in
  2. Bring up the search for class dialog (alt-o in my mac keymap, can't remember if I customized this or not)
  3. search for your class
  4. Select it then hit cmd-shift-enter, it will open in the editor your cursor is in even if it is already open in another editor pane
0
Comment actions Permalink

Here's how to do it:

Alt-Shift-Enter

In the 'Open File' or 'Go To Class' dialog, or Project view, press Alt-Shift-Enter (instead of just Enter) to have the selected file open in the current pane even if it's already open in another pane.

Shift-Enter will open the file in a floating window.

Older versions of IntelliJ

In older versions of IntelliJ (maybe before IntelliJ 2016, and sometime after IntelliJ 8): this shortcut was just Shift-Enter.

0

Please sign in to leave a comment.