Tag Archives: Shortcuts to copy and move lines

Eclipse : [Top 50] Keybord Shortcuts


Why eclipse shortcuts?

To make developer more productive eclipse provides keyboard shortcuts to perform faster for more common actions.

“The less you touch the mouse, the more code you can write”

Eclipse also supports most common shortcuts used with all common editors like , Ctrl+C for copy, Ctrl+S for saving, Ctrl+V for paste etc.

How to get complete list of eclipse shortcuts?

You can get complete list of eclipse shortcuts after following below steps:

  1. Open Eclipse IDE
  2. Got to help. (Screen 1)
  3. Click on “Show active key bindings” or “Key Assist” depend on IDE. (Screen 2)
  4. On eclipse bottom right corner you will see complete list of eclipse shortcuts.

or

For getting these shortcuts also have one shortcut as Ctrl + Shift + L. (Screen 2)

Screen 1

Eclipse keyboard Short Cuts -1

Screen 2

Eclipse keyboard Short cuts

From above screen you can gets list of all eclipse shortcuts but here we will focus on most common used by developers in day to day development activity.

What are most commonly used shortcuts by developers to make more productive?

Here is list of most frequently used shortcuts by developers and corresponding description.

  • Ctrl+Shift+R  : Search dialog for resources,  java files,  xml files and properties etc. based on name and matches. as in screen below.

eclipse short key cntr short R

same way you can also try others as below.

  • Ctrl+Shift+T : Search dialog for finding files from jar.
  • Ctrl+F8 : Shortcut for switching perspectives
  • Ctrl + Sift +F : for auto formatting
  • Ctrl + Shift + P : find closing braces
  • Ctrl+O : Shows quick outline for going to class method.
  • Ctrl + /  : for commenting, uncommenting lines and blocks

Shortcuts to navigation between editors

  • Ctrl+E : Search dialog to select an editor from the currently open editors
  • Alt+← :Go to previous opened editor. Cursor is placed where it was before you opened the next editor
  • Alt+→ : Similar Alt + ← but opens the next editor
  • Ctrl+Q : Go to editor and the position in this editor where the last edit was done
  • Ctrl+PageUp : Switch to previous opened editor
  • Ctrl+PageDown : Switch to next opened editor

Shortcuts to navigation between views

  • Ctrl + F7 : Shortcut for switching views. Choose the view to switch to with your mouse or cycle through the entries with repeating the keystroke
  • Shift+Alt+Q : Open menu for switch view keybindings
  • Shift+Alt+Q+P, Shift +Alt +W : Show package explorer
  • Shift+Alt+Q+C : Show console

Shortcuts to start Java programs

  • Ctrl+F11 : Run last launched
  • F11 : Run last launched in debug mode
  • Ctrl+Alt+B : Skip all breakpoints. Let’s you use debug mode for code reloading
  • Alt+Shift+X, J : Run current selected class as Java application
  • Alt+Shift+X, T : Run JUnit test
  • Alt+Shift+X, P : Run JUnit Plug-in test

Shortcuts to editing in the Java editor

  • Shift+Alt+↑ : Selects enclosing elements.,result depending on cursor position
  • Ctrl+1 : Quickfix; result depending on cursor position
  • Ctrl+Space : Content assist/ code completion
  • Ctrl+T : Show the inheritance tree of the current Java class or method.
  • Ctrl+O : Show all methods of the current class, press Ctrl + O again to show the inherited methods.
  • Ctrl+M : Maximize active editor or view
  • Ctrl+Shift+F : Format source code
  • Ctrl+I : Correct indentation, e.g., format tabs/whitespaces in code
  • Ctrl+F : Opens the find dialog
  • Shift+Enter :  Adds a link break at the end of the line
  • Ctrl+Shift+O : Organize the imports; adds missing import statements and removes unused ones
  • Alt+Shift+Z : Wrap the select block of code into a block, e.g. try/catch.
  • Ctrl + /  : for commenting, uncommenting lines and blocks
  • Ctrl + Shift + /  : for commenting, uncommenting lines with block comment
  • Selecting class and pressing F4 to see its Type hierarchy
  • Ctrl + F4 , Ctrl + w : for closing current file
  • Ctrl+Shift+W :  for closing all files.
  • Ctrl + l :  go to line
  • Select text and press Ctrl + Shift + F for formatting.
  • Ctrl + F :  for find, find/replace
  • Ctrl + D :  to delete a line
  • Ctrl + Q :  for going to last edited place

Shortcuts to cursor navigation and text selection

  • Ctrl+← or Ctrl+→ : Move one text element in the editor to the left or right
  • Ctrl+↑ or Ctrl+↓ : Scroll up / down a line in the editor
  • Ctrl+Shift+P : Go to the matching bracket
  • Shift+Cursor movement : Select text from the starting position of the cursor
  • Alt+Shift ↑ / ↓ : Select the previous / next syntactical element
  • Alt+Shift ↑ / ↓ / ← / → : Extending / reducing the selection of the previous / next syntactical element

Shortcuts to copy and move lines

  • Ctrl+Alt+↓ : Copy current line below the line in which the cursor is placed
  • Ctrl+Alt+↑ : Copy current line above the line in which the cursor is placed
  • Alt+Up : Move line one line up
  • Alt+Down : Move line one line down

Shortcuts to delete lines

  • Ctrl+D : Deletes line
  • Ctrl+Shift+DEL : Delete until end of line
  • Ctrl+DEL : Delete next element
  • Ctrl+BACKSPACE : Delete previous element

Shortcuts to create new lines

  • Shift+Enter : Adds a blank line below the current line and moves the cursor to the new line. The difference between a regular enter is that the currently line is unchanged, independently of the position of the cursor.
  • Ctrl+Shift+Enter : Same as Shift + Enter but above

Shortcuts to variable assignment

  • Ctrl+2, L : Assign statement to new local variable
  • Ctrl+2, F : Assign statement to new field

Shortcuts to coding

  • Shift+F2 : Show the Java doc for the selected type / class / method
  • Alt+Shift+N : Shortcut for the menu to create new objects
  • Alt+Shift+Z : Surround block with try and catch

Shortcuts to refactoring

  • Alt+Shift+R : Rename
  • Ctrl+2, R : Rename locally (in file), faster than Alt + Shift + R
  • Alt+Shift+T : Opens the context-sensitive refactoring menu, e.g., displays

Shortcuts must known by every developer

The following shortcuts are the absolute minimum a developer should be familiar with to work efficient in Eclipse.

  • Ctrl+S : Saves current editor
  • Ctrl+1 : Quick fix; shows potential fixes for warnings, errors or shows possible actions
  • Ctrl+Space : Content assist/ code completion
  • Ctrl+Q : Goes to the last edited position
  • Ctrl+D : Deletes current line in the editor
  • Ctrl+Shift+O : Adjusts the imports statements in the current Java source file
  • Ctrl+2, L or F : Assign statement to new local variable or field
  • Ctrl+Shift+T : Open Type Dialog
  • Ctrl+F11 : Run last launched application
  • Shift+F10 : Opens context menu. Keyboard equivalent to Mouse2
  • Ctrl+F10 : Opens view menu for current view.

If you are using some more useful Eclipse keyboard shortcuts which are not included then please post as comments, I will include them in this list. Let me know if you face any issues while using these eclipse shortcuts in any particular version of Eclipse IDE.