Quick Ways To Navigate Eclipse Editors Using the Keyboard
Join the DZone community and get the full member experience.Join For Free
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.
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.
Opinions expressed by DZone contributors are their own.