My favorite Eclipse shortcuts

This is a collection of Eclipse shortcuts I use often:

Mange Files and Projects

  • Alt+Enter: Show file properties of file open in the editor.
  • Ctrl+S: Save the current file.
  • Ctrl+Shift+S: Save all open files.
  • Ctrl+W: Close the current file.
  • Ctrl+Shift+W: Close all open files.
  • F5: Refresh selected workspace element with the local file system.

Editor window:

  • Ctrl+E: Show list of files open in the editor. The popup can be navigated with the arrow keys and enter to switch file.
  • Ctrl+Shift+E: Similar to Ctrl+E but a dialog.
  • Ctrl+M: Maximize the active window. Hit Ctrl+M to restore the original size. This works for all types of windows not only the editor.
  • Alt+Arrow Left and Alt+Arrow Right: Go to previous and go to next file in the editor window.
  • F12: Jump to the editor window.

Edit source code:

  • Ctrl+Space: Code completion.
  • Ctrl+/: Comment out the current line or if multiple lines are selected comment out all the selected lines. To uncomment the lines select the lines and hit Ctrl+/ again.
  • Ctrl+Shift+/: Add block comment around selection.
  • Ctrl+Shift+\: Remove block comment around selection.
  • Als+Shift+J: Add element comment.

Refactoring:

  • Alt+Shift+R: Rename the selected element and all references.

Errors:

  • Ctrl+-: Go to the next error in the current editor.
  • F2: Show the error for the position under the cursor.

Run:

  • Shift+Alt+X S: Run a Scala application. Displays a popup menu with possible execution commands and runs the Scala application. A source file with main method must be open in the current editor.
  • Ctrl-F11: Launch the application. A source file with main method must be open in the current editor or alternatively Eclipse must be configured to run the last application.

Search and navigate source code:

  • Ctrl+3: Search all commands available. Try typing “git”. Pretty cool, right?
  • Ctrl+Shift+R: Quickly search for all file names that contain a certain term in projects open in the workspace. Easy to quickly find some source file.
  • Ctrol+O: Display a quick outline with all the definitions in the current editor.
  • F3: Navigate to the definition of the variable/class/type under the cursor.

Leave a comment