Quick Ways To Navigate Eclipse Editors Using the Keyboard

DZone 's Guide to

Quick Ways To Navigate Eclipse Editors Using the Keyboard

· Java Zone ·
Free Resource

You’ll often end up with a lot of open editors in Eclipse and consequently needing to navigate between them. You can use the mouse for this, but that often disturbs your flow when your typing, slowing you down.

That’s why there are a number of ways to navigate between editors in Eclipse using only the keyboard. Combined with the ability to quickly navigate views using the keyboard, it’s an easy way to work faster and almost get rid of the mouse (reducing company spending… well, slightly).

Cycle through open editors

This is probably the fastest way to navigate between editors in most cases. When you press Ctrl+F6 (Next Editor), a popup appears with a list of  all open editors. The list is sorted in order of most recently used, so if you press Ctrl+F6 and release it immediately, Eclipse will take you to the last active editor. Press Ctrl+Shift+F6 to reverse the direction.

This is a great way of jumping between 2 editors, eg. to read something in the one while typing in the other. Here’s an example showing what happens when you press Ctrl+F6 while on Template.java.

I strongly recommend mapping the Next Editor command to Ctrl+Tab in addition to (or instead of) Ctrl+F6. Just make a binding for the command Next Editor under Window > Preferences > General > Keys – see how to manage your keyboard shortcuts for details on how to do this. But why remap the key? Well, not only is it a lot easier and faster to press (you can use one hand to do this), it’s also standard for most Windows applications so you may already be familiar with it. It makes switching editors 5 times faster (yes, statistically proven).

Another way of using cycling is to press Ctrl+F6 and then press F6 repeatedly while holding down Ctrl. Eclipse will highlight the next editor in the list until you release Ctrl, after which it will activate the highlighted editor. This is a good way to navigate a short list of editors (eg. 5-10 open editors) but can get a bit cumbersome when there are more editors.

Quick Switch Editor

Another fast way of navigating editors is via the Quick Switch Editor functionality. I’ve posted another tip dedicated entirely to this feature, so won’t discuss it in detail here but just give a brief rundown of how it works. Basically, it’s great when you have a large number of editors open.

By pressing Ctrl+E, you can get a list of all open editors. This list is searchable  and even supports wildcards, which is why it’s great for cases where you have a large number of editors open. The Quick Switch Editor is also flexible in that it supports closing editors directly without activating them. Here’s an example of what you’ll see:

Move sequentially from one editor to the next

You can also move between editors in the order of their tabs in the editor area. To move to the next editor just press Ctrl+Page Down, while Ctrl+Page Up takes you to the previous editor.

In the example below, when you press Ctrl+Page Down, Eclipse will activate the editor Engine.java, assuming that we’re currently positioned on TestSomeUtils.java. Repeating this will take you to ClientDataSource.java.

Moving between editors sequentially is sometimes useful, but the big drawback of it is that it doesn’t consider which editors you’ve been working on recently (in my experience, the more likely case) so can be slow in those scenarios.

Bonus Tip: If you’re wondering how to move between different pages of a multipage editor (eg. plugin.xml below), then just press Alt+F7 to move to the next page and Alt+Shift+F7 for the previous page. Multipage editors used to “break” Ctrl+Page Down navigation in previous versions of Eclipse because they’d hijack the key preventing you from moving to the next editor. This has changed in Eclipse 3.5.

Which one should I use when?

Here are some recommendations on when to use what to work most efficiently:

  • If you want to quickly move between the editors you’ve used recently, use editor cycling . This is such a common requirement, that this is probably the editor navigation I use the most. Remember to create an additional binding for it to Ctrl+Tab – it works a lot faster.
  • If you’ve got a large list of open editor (eg. 10+) then use the Quick Switch Editor. Editor cycling is a decent choice up until about 10 editors.
  • If you just quickly want to browse the editors one by one to scan through them (eg. you have a couple of XML files you want to scan briefly), then use the sequential navigation.

In summary, focus on learning editor cycling, then using the Quick Switch Editor. After that, pick from some of the others depending on how you work.

Quick mentions

Here are a couple of other ways to navigate editors, but, although they do come in handy sometimes, they may not be as efficient as the ones above.

  • Use Eclipse’s History functionality to move back to previous editors, similar to using a browser history. Press Alt+Left to go back to the previous editor and Alt+Right to go forward. This is useful when switching back and forth between 2 different editors or when you want to an editor that you’ve closed, as the history also reopens closed editors.
  • An overlooked-but-useful Eclipse feature is the most recently used list under the File menu. Just press Alt+F, 1 (or any other number that’s indicated in the menu) to go to the most recently opened editor. This is useful when you’ve accidentally closed an editor you still want to use.


From http://eclipseone.wordpress.com/2010/05/25/quick-ways-to-navigate-eclipse-editors-using-the-keyboard/


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}