Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij - Split Screen Creates Duplicate

When I have two Java files, and I want to compare them side-by-side, I split them vertically. However, I end up with 3 Java files, because it duplicates the one I split, instead of just moving it.

Is there a way to change the behavior such that it just splits the two files I have open, rather than creating a 3rd?

like image 280
EdgeCase Avatar asked Oct 03 '13 14:10

EdgeCase


2 Answers

Not sure when this feature was added, but you can simply right-click the tab and choose Move Right ; it has the effect of splitting horizontally and then closing the old tab.

like image 90
rdchambers Avatar answered Oct 23 '22 18:10

rdchambers


This is not possible. The concept of a split is just that, to split an editor. See Splitting and Unsplitting Editor Window in the help guide. You can create a second editor window by dragging a tab off the main editor window. See Detaching Editor Tabs in the help guide. Note, if you already have a split in place, you can drag a file from one split pane to the other.

You can also write a macro to accomplish what you want.

  1. Give the tab you want to split focus
  2. From the menu: Edit > Macros > Start Macro Recording
  3. Record the following sequence:
  4. Right click on the tab and split it
  5. Type ctrl+F4 (or F4) to close the original window
  6. Stop the macro (either view the popup in the bottom or via the Edit > Macros > Stop Macro Recording)
  7. In the dialog, give the macro a name.

You can now either run the macro from File > Edit > Macros, or you can map a keyboard shortcut to it. See Binding Macros with Keyboard Shortcuts in the help guide for how to do such.

like image 33
Javaru Avatar answered Oct 23 '22 17:10

Javaru