How do you split and unsplit a window/view in Eclipse IDE? - eclipse

How do you split a window/view in Eclipse IDE? I want to edit code while viewing the different code in the same file.
If there is a trick to open the same file twice, this might do, but I would rather just split the one current view instead of having two of the same which might get confusing.

This is possible with the menu items Window>Editor>Toggle Split Editor.
Current shortcut for splitting is:
Azerty keyboard:
Ctrl + _ for split horizontally, and
Ctrl + { for split vertically.
Qwerty US keyboard:
Ctrl + Shift + - (accessing _) for split horizontally, and
Ctrl + Shift + [ (accessing {) for split vertically.
MacOS - Qwerty US keyboard:
⌘ + Shift + - (accessing _) for split horizontally, and
⌘ + Shift + [ (accessing {) for split vertically.
On any other keyboard if a required key is unavailable (like { on a german Qwertz keyboard), the following generic approach may work:
Alt + ASCII code + Ctrl then release Alt
Example: ASCII for '{' = 123, so press 'Alt', '1', '2', '3', 'Ctrl' and release 'Alt', effectively typing '{' while 'Ctrl' is pressed, to split vertically.
Example of vertical split:
PS:
The menu items Window>Editor>Toggle Split Editor were added with Eclipse Luna 4.4 M4, as mentioned by Lars Vogel in "Split editor implemented in Eclipse M4 Luna"
The split editor is one of the oldest and most upvoted Eclipse bug! Bug 8009
The split editor functionality has been developed in Bug 378298, and will be available as of Eclipse Luna M4. The Note & Newsworthy of Eclipse Luna M4 will contain the announcement.

You can open a new editor from the Window menu.
This will give you your current editor once again.

If you right click on one of the tabs, one of the options should be New Editor (for me, it's at the bottom). Select that, and then drag the new tab onto the bottom scroll bar of the code editor, which will split the editor panel in two.

Just click and drag editor title to left, right, top or bottom

I tried the above solutions in Eclipse Luna 4.4.1 but couldn't open two (or multiple editor windows for different files side by side).
Simplest Solution:
Open all files you want in a single window.
Drag the tab of each of the files to right or to the left, eclipse will automatically display a split screen display and will split the editor into two windows once you leave the mouse button.
repeat for each file/tab.
Happy Coding!

Side by side editors in single Eclipse window.
You have an Eclipse window showing a single editor.
Window -> new editor. You now have two editor tabs.
Click and drag one tab towards the right and a green outline of a vertical screen appears (drag tag towards the bottom and an outline of a horizontal screen outline appears). You can let go as soon as the outline appears.
Open file of choice in 2nd editor (recent files show up at bottom of file menu).
ADT/Eclipse:Build: v22.3.0-887826

You might want to check an eclipse plugin called HandySplit
It allows to split an editor into two and move tabs from one editors stack to another with keyboard shortcuts only.
That works on Eclipse Juno or higher.
For the previous Eclipse versions check this out

Simply go to Window > New Window
This will open up a new window of the same Workspace in eclipse.
You can open up separate files in each Window.

Below are the steps to split editor horizontally or vertically
go to:
Window -> Editor -> Toggle Split Editor (Horizontal)
to split editor horizontally or
Window -> Editor -> Toggle Split Editor (vertical)
to split editor vertically.
It will open two editors side by side or will pileup tow.

If you want to see two different files in same eclipse you can,
Right-click a tab -> Detach
Now you can see both files at the same time without opening new eclipse and you can drag and reatach to tabs again.

On Mac OS, the key combination to toggle spit/unsplit for horizontal split is ⌘ ⇧ - ("cmd"+"shift"+"-"), whereas for vertical split, it is ⌘ ⇧ [ ("cmd"+"shift"+"[")

Related

How do I open the same file side by side in a single Visual Studio Code session?

Say I'm reading file xyz.py. And I want to see both func_x and class_y at the same time, so that I don't have to keep on scrolling up and down to go back and forth.
How would I open file xyz.py side-by-side so that I can read both at the same time?
Note: This is different from the question Visual Studio Code: How to split the editor vertically, as it doesn't explain how to have the same window side by side.
In the top right of your screen there should be a split editor button that looks like this:
That should do the trick.
The default keyboard shortcut (on windows) is Ctrl+\
In Command Palette
(Ctrl or ⌘+Shift+P)
Type split e Enter
(Select View: Split Editor)
In sidebar
Alt+Left-click the file
In editor
Click the Split Editor button () in the upper right corner.
None of the above worked for me
but ⌘ + \ worked.

Visual Studio Code: How to split the editor vertically

In Visual Studio Code, a while ago, when I used menu View → Split Editor, it would split vertically. (One file on the left and one file on the right.)
I updated Visual Studio Code and when when I do menu View → Split Editor, it always splits horizontally. (One file on the top and one file on the bottom.)
How can I split vertically?
Change editor split layout from horizontal to vertical
In 1.20
ALT+SHIFT+0 PC (Windows, Linux)
⌘+⌥+0 Mac
Pre-1.20
ALT+SHIFT+1 PC (Windows, Linux)
⌘+⌥+1 Mac
In 1.25
You can split editor into Grid layout. Check View=>Editor Layout
It is nicely presented in Release notes v1.25: VS Code grid editor layout
In 1.58.2 **
** Someone update this with the lowest version where this became true.
The menu entry with the shortcut given above is View=>Editor Layout=>Flip Layout
The Command Palette entry is labeled "Toggle Vertical/Horizontal Editor Layout"
The settings entry is
{
"key": "alt+cmd+0",
"command": "workbench.action.toggleEditorGroupLayout"
}
If you're looking for a way to change this through the GUI, at least in the current version 1.10.1 if you hover over the OPEN EDITORS group in the EXPLORER pane a button appears that toggles the editor group layout between horizontal and vertical.
To split vertically:
⌘+\ Mac
command: workbench.action.splitEditor
To split orthogonal (ie. horizontally in this case):
⌘+k+⌘+\ Mac
command: workbench.action.splitEditorOrthogonal
Method 1
Method2
View -> Command palette -> type 'split'
Method3
Method4
Tip
Add a Keyboard Shortcut for split Editor
Press CMD + SHIFT + P (MAC) and search for Toggle Editor Group
In version 1.23.1, it is Ctrl+Shift+P and Split Editor
This will divide the screens vertically and you can move through them using Ctrl+K+LeftArrow
By default, editor groups are laid out in vertical columns (e.g. when you split an editor to open it to the side). You can easily arrange editor groups in any layout you like, both vertically and horizontally:
To support flexible layouts, you can create empty editor groups. By default, closing the last editor of an editor group will also close the group itself, but you can change this behavior with the new setting workbench.editor.closeEmptyGroups: false:
There are a predefined set of editor layouts in the new View > Editor Layout menu:
Editors that open to the side (for example by clicking the editor toolbar Split Editor action) will by default open to the right hand side of the active editor. If you prefer to open editors below the active one, configure the new setting workbench.editor.openSideBySideDirection: down.
There are many keyboard commands for adjusting the editor layout with the keyboard alone, but if you prefer to use the mouse, drag and drop is a fast way to split the editor into any direction:
Keyboard shortcuts#
Here are some handy keyboard shortcuts to quickly navigate between editors and editor groups.
If you'd like to modify the default keyboard shortcuts, see Key Bindings for details.
⌥⌘→ go to the right editor.
⌥⌘← go to the left editor.
⌃Tab open the next editor in the editor group MRU list.
⌃⇧Tab open the previous editor in the editor group MRU list.
⌘1 go to the leftmost editor group.
⌘2 go to the center editor group.
⌘3 go to the rightmost editor group.
unassigned go to the previous editor group.
unassigned go to the next editor group.
⌘W close the active editor.
⌘K W close all editors in the editor group.
⌘K ⌘W close all editors.
Simply in windows
ctrl + # (the button 2 in the upper horizontal row of numbers in keyboard)
The key bindings has been changed with version 1.20:
SHIFT+ALT+0 for Linux.
Presumably the same works for Windows also and CMD+OPT+0 for Mac.
Use Move editor into Next Group shortcut:
Mac: ^ + ⌘ + Right/Left arrow
If you want to change shortcut:
Open Command Pallette (macOS keyboard shortcut: ⌘ + Shift + p)
Select Preferences: Open Keyboard Shortcuts
Search View: Move editor into Next Group
To change the editor in Landscape and Vertical mode, follow the steps below.
For example, open two files that you have in your left or right side bar, depending on where you are placed. By default it is always on the left.
Now that you have both windows open, you have to use the key combination for PC (Alt + Shift + 1) for (Windows and Linux Operating Systems) or for MAC (Cmd + Option + 1), as commented here v-andrew.
I just found a simple solution. You can drag an opened file and move towards the four sides of the Editor, it will show a highlighted area that you can drop to. It will split the view automatically, either horizontally, vertically, or even into three rows.
VSCode v1.30.2
Update: you can also drag a file from the Explorer to split the Editor in the same way above.
Right-click on the tab that you want to split it into another screen.
Then choose whether you want to split it (up-down | right-left).
I find this is the quickest way, and You can split it to as many screens as you want.
The best way is to configure the VSCode settings to make the default behavior the way you want:
Split Editor (to a new editor group)
"workbench.editor.openSideBySideDirection": "right" // left/right (default)
"workbench.editor.openSideBySideDirection": "down" // up/down
Split Editor in Group (does not create new editor group)
"workbench.editor.splitInGroupLayout": "horizontal" // left/right (default)
"workbench.editor.splitInGroupLayout": "vertical" // up/down

How do you join back the split editor panes in eclipse

On Eclipse, with Window -> New Editor or by drag/drop method* I could have one more editor panes in my eclipse work area. Now how do I remove that extra pane when I do not need it anymore. All it allows me now is to minimize/maximize that editor extra pane. It just sticks around. Shouldn't there be a collapse or close extra editor panes (that is without me requiring to do Window->Reset Perspective!)
Ref: answers to another question: How do you split and unsplit a window/view in Eclipse IDE?
Right-click on a tab in the window you want to close and select "close all". This will close the split window (and close any tabs in that window that have not been dragged to another window).
HandySplit has a flatten action that you need and other capabilities that you might find useful.

Shortcut for "move to left editor" and "move to right editor" in Eclipse?

If I've got my Eclipse windows split vertically, is there any keyboard shortcut to move to the logical left/right editor?
For example, in the image blow, the right editor is selected, and I want to move to the left window:
For those of you who know Vim, I am trying to recreate c-w h and c-w l.
The answer from Csaba_H is right : there is no keyboard shortcut to switch from one editor area to the next. The most you can do through keyboard shortcuts is to switch to "another editor", whatever its area is (left, right, top, bottom... whatever you tiled the area into :p) through the usual shortcuts :
next editor : ctrl + F6
previous editor : ctrl + shift + F6
quick switch editor : ctrl + E
I'll only mention that you can also take a look yourself to all available shortcuts in your Eclipse if you go to Window > preferences and go into the section General > Keys (a shortcut to get there is to use ctrl + shift + L twice).
Personally I did not find such shortcut or option. However, there are some possibilities for switching editors from the keyboard (Ctrl + F6 and Ctrl + Shift + E as general ones, or my favourite "all-in-one" Ctrl + 3 :) ).
Also, if you work mostly two files 'for a long time' (one in left side and one on right side), you can also use the History operations (Alt + ←, Alt + →) for switching editors.
Eclipse allows for multiple editors to be open at any time, and those editors may be arranged as tabs (default behaviour) or split vertically or horizontally. The information above about available shortcut options is correct and provides the correct functionality in the case of two (only) open editors. Where there are greater than two open editors the shortcuts allow navigation to the 'next' or 'previous' editor. There is no concept of the logical left/right or top/bottom editor.
Just found it!
Ctrl + Page Up and Ctrl + Page Down.
It's just Ctrl + Tab and Ctrl + Shift + Tab on my windows! try it.
In all my eclipse usage I've never noticed such a shortcut and I would not expect one to exist. I skimmed though the link provided by Anthony and checked my own copy of eclipse, but none of it looked like what you're looking for.
You can also look through them yourself by going to: Window > Preferences > General > Keys
I'm not sure if there is something in vanilla Eclipse, but you might want to check out "Emacs+" in the Eclipse Marketplace.
From http://www.mulgasoft.com/ :
"Other Window (Ctrl-X O): Navigate to the previous editor window"
It's not perfect, but it will achieve something close to what you want.
You can also split the window with shortcuts as well.
Quick Access Ctrl+3 has been very useful in Eclipse.
Otherwise, I know of two external programs that navigate by dividing the screen into smaller chunks, using only your keyboard.
If you're on Windows, you can use Mouser, which is coded in Autohotkey and based on keynav. If you find the source, remapping the keys is fairly straightforward.
If you're on Linux, keynav is your friend.
sudo apt-get install keynav
You'll have to change the configuration file to use arrow keys. (The default uses vim-like navigation.)
For focusing panels in Eclipse, I average between two-to-three keystrokes.

Eclipse: have the same file open in two editors?

When I'm editing a large file, I often want to have it open in two editing windows at once (eg. for reference, or because I'm working on two different parts of the file at once).
Is there any way to do this with Eclipse?
Open your file and then Window->New Editor (Note: in newer versions it will be called New Window)
Then, click on its tab and drag it somewhere else to have two editors of the same file
Update: as mentioned by moschlar, From version 4.4, two editors can be created with Window -> Editor -> Clone.
In Eclipse Luna (4.4) and above, this is supported out of the box: Window -> Editor -> Clone.
I realize he specified a new editing window. Showing an alternative for those, like me, that do not want a new editor but would like to be able to look at the file in two places at the same time in the same tab.
Window -> Editor -> Toggle Split Editor will split the editor horizontally or vertically.
Ctrl + _ is horizontal and Ctrl + { is vertical. More precisely it's Ctrl + Shift + - and Ctrl + Shift + [.
I had issues with it in Mars (see note below) that seem to have cleared up in Neon.
Mars Note: The split editor seems a bit buggy. The JavaScript editor likes to jump the cursor to the other pane momentarily when it does a while-you-type-validation.
Right click on your editor tab and select "New Editor".
... unless you have a newer version of eclipse, in which case do Window -> New Editor.
Window -> Editor -> Clone is also available in Neon 2 and, judging from the other comments seems to be available in all newer Eclipses.
It's my preferred solution.
In order to keep answers up to date i underline that with Eclipse STS this action is performed using window -> Editor -> Toggle split editor (horizental) | Toggle split editor (vertical)
In Eclipse Mars there is another way of doing it:
Window -> Editor -> Clone.
then drag the cloned tab to the corner to create a parallel window.
This seems to now be in the File-> New View Into File which opens the tab with focus into a new tab in the same group where you can then drag it to another group if you wish.