YouTip LogoYouTip

Eclipse Shortcuts

## About Shortcuts Many operations in Eclipse provide shortcut key functionality, allowing us to control various Eclipse features well using the keyboard: * Use shortcut keys to access menus or menu items * Use shortcut keys to access dialog windows, views, or editors * Use shortcut keys to access function buttons on the toolbar !(#) The Eclipse shortcut key list can be opened using the shortcut key Ctrl + Shift + L. !(#) * * * ## Setting Shortcut Keys The shortcut keys provided by the Eclipse system can sometimes be difficult to remember, or there may be no shortcut key provided at all, requiring manual setup. We can enter the shortcut key management interface by clicking window->preferences->general->keys (or directly searching for keys): ![Image 3: shortcut1](#) Here you can find the shortcut keys for all functions. To modify or add a new one, click on the command you want to modify or add, and set the shortcut key in the binding field: ![Image 4: shortcut2](#) After setting the shortcut key, you also need to set when this shortcut key can be used. Eclipse provides various scenarios for selection; generally, choosing "In Windows" (i.e., when the Eclipse window is active) is sufficient. ![Image 5: shortcut3](#) After completing the above operations, click the OK button to finish the setup. * * * ## Common Eclipse Shortcut Keys | Shortcut Key | Description | | --- | --- | | Editing | | Ctrl+1 | Quick Fix (the most classic shortcut key, no need to say more, it can solve many problems, such as importing classes, try-catch wrapping, etc.) | | Ctrl+Shift+F | Format current code | | Ctrl+Shift+M | Add import for a class | | Ctrl+Shift+O | Organize imports for classes (has the function of Ctrl+Shift+M and can also help you remove unused imports, very useful) | | Ctrl+Y | Redo (opposite of Undo Ctrl+Z) | | Alt+/ | Content Assist (saves you so many keystrokes, very commonly used) | | Ctrl+D | Delete current line or multiple lines | | Alt+↓ | Swap current line with the line below (very practical, saves you from cutting and pasting) | | Alt+↑ | Swap current line with the line above (same as above) | | Ctrl+Alt+↓ | Copy current line to the line below (copy and add) | | Ctrl+Alt+↑ | Copy current line to the line above (copy and add) | | Shift+Enter | Insert a blank line below the current line (the mouse can be anywhere on the current line, not necessarily at the end) | | Ctrl+/ | Comment the current line, press again to uncomment | | Selection | | Alt+Shift+↑ | Select enclosing element | | Alt+Shift+← | Select previous element | | Alt+Shift+β†’ | Select next element | | Shift+← | Select characters to the left from the cursor | | Shift+β†’ | Select characters to the right from the cursor | | Ctrl+Shift+← | Select the word to the left of the cursor | | Ctrl+Shift+β†’ | Select the word to the right of the cursor | | Movement | | Ctrl+← | Move cursor to the beginning of the left word, equivalent to vim's b | | Ctrl+β†’ | Move cursor to the end of the right word, equivalent to vim's e | | Search | | Ctrl+K | Quickly locate the next occurrence of the selected word (if no word is selected, search for the word used in the previous search) | | Ctrl+Shift+K | Quickly locate the previous occurrence of the selected word | | Ctrl+J | Forward incremental search (after pressing Ctrl+J, each letter you type provides quick matching to locate a word in the editor; if not found, it displays "not found" in the status bar. Very useful when searching for a word; press Escape to exit this mode) | | Ctrl+Shift+J | Reverse incremental search (same as above, but searches backwards) | | Ctrl+Shift+U | List all lines containing the string | | Ctrl+H | Open the search dialog box | | Ctrl+G | Declarations in workspace | | Ctrl+Shift+G | References in workspace | | Navigation | | Ctrl+Shift+T | Search for classes (including projects and associated third-party JAR packages) | | Ctrl+Shift+R | Search for files in the project | | Ctrl+E | Quickly display the dropdown list of current Editors (if the current page is not displayed, it is shown in bold) | | F4 | Open type hierarchy | | F3 | Jump to declaration | | Alt+← | Previous edited page | | Alt+β†’ | Next edited page (of course, relative to the previous one) | | Ctrl+PageUp/PageDown | In the editor, switch between already opened files | | Debugging | | F5 | Step Into | | F6 | Step Over | | F7 | Step Return | | F8 | Continue | | Ctrl+Shift+D | Display variable value | | Ctrl+Shift+B | Set or remove breakpoint on the current line | | Ctrl+R | Run to Line (very useful, can save many breakpoints) | | Refactoring (generally, refactoring shortcut keys start with Alt+Shift) | | Alt+Shift+R | Rename method, property, or variable name (one of my personal favorites, especially for renaming variables and classes, saves a lot of manual effort) | | Alt+Shift+M | Extract a piece of code from a function into a method (one of the most commonly used refactoring methods, especially useful for a bunch of messy code) | | Alt+Shift+C | Modify function structure (quite practical, if N functions call this method, modify it once and it's done) | | Alt+Shift+L | Extract local variable (can directly extract some magic numbers and strings into a variable, especially when called in multiple places) | | Alt+Shift+F | Change local variables in a Class to field variables (a practical function) | | Alt+Shift+I | Inline variable (maybe this phrasing is not entirely accurate) | | Alt+Shift+V | Move functions and variables (not commonly used) | | Alt+Shift+Z | Undo for refactoring (Undo) | | Others | | Alt+Enter | Display properties of the currently selected resource, the shortcut key for viewing file properties in Windows, usually used to view the actual path of a file in Windows | | Ctrl+↑ | Text editor scroll up line | | Ctrl+↓ | Text editor scroll down line | | Ctrl+M | Maximize current Edit or View (press again to reverse) | | Ctrl+O | Quickly display OutLine (essential shortcut key for those who don't open the Outline window) | | Ctrl+T | Quickly display the inheritance structure of the current class | | Ctrl+W | Close current Editor (also used to close opened dialog boxes in Windows, as well as in QQ, Wangwang, browsers, etc.) | | Ctrl+L | Text editor go to line | | F2 | Display tooltip description |
← Server FlushallEclipse Install Plugins β†’