IntelliJ IDEA is a powerful integrated development environment (IDE) used by
many developers. Mastering its shortcuts can significantly boost your
productivity. This guide covers essential shortcuts and provides examples of how
to use them effectively.
Table of Contents
- Navigation Shortcuts
- Editing Shortcuts
-
Code Completion and Generation
- Refactoring Shortcuts
- Search and Replace
- Running and Debugging
- Version Control
- Miscellaneous
1. Navigation Shortcuts
Shortcut |
Function |
Example |
Ctrl+N / Cmd+O |
Go to Class |
Type "MainA" to find MainActivity.java |
Ctrl+Shift+N / Cmd+Shift+O |
Go to File |
Type "style" to find styles.xml |
Ctrl+E / Cmd+E |
Recent Files |
|
Ctrl+Alt+Left/Right / Cmd+Option+Left/Right |
Navigate Back/Forward |
|
Ctrl+B / Cmd+B |
Go to Declaration |
Place cursor on 'name' and use the shortcut to jump to its declaration
|
Ctrl+Alt+B / Cmd+Option+B |
Go to Implementation |
|
Ctrl+F12 / Cmd+F12 |
File Structure |
|
Ctrl+G / Cmd+L |
Navigate to Line |
|
Alt+Down/Up / Control+Down/Up |
Next/Previous Method |
|
2. Editing Shortcuts
Shortcut |
Function |
Example |
Ctrl+Space |
Basic Code Completion |
Press Ctrl+Space to see methods like toLowerCase() |
Ctrl+Shift+Space |
Smart Code Completion |
|
Ctrl+W / Option+Up |
Extend Selection |
|
Ctrl+Shift+W / Option+Down |
Shrink Selection |
|
Ctrl+/ / Cmd+/ |
Comment/Uncomment Lines |
|
Ctrl+D / Cmd+D |
Duplicate Line or Selection |
|
Ctrl+Y / Cmd+Backspace |
Delete Line |
|
Alt+Shift+Up/Down / Option+Shift+Up/Down |
Move Line Up/Down |
|
Alt+Click / Option+Click |
Multiple Cursors |
|
Alt+Shift+Insert / Cmd+Shift+8 |
Column Selection Mode |
|
3. Code Completion and Generation
Shortcut |
Function |
Example |
Alt+Insert / Cmd+N |
Generate Code |
Use this shortcut to generate a constructor in a Java class |
Ctrl+Shift+Enter |
Complete Statement |
Press Ctrl+Shift+Enter to complete with braces |
Ctrl+Alt+T / Cmd+Option+T |
Surround With |
Select a block of code and use this shortcut to surround it with a
try-catch block
|
Ctrl+J / Cmd+J |
Insert Live Template |
Type "sout" and use this shortcut to insert System.out.println() |
Ctrl+J / Cmd+J |
Postfix Completion |
Expands "someString.notnull" to "if(someString != null) { ... }" |
4. Refactoring Shortcuts
Shortcut |
Function |
Example |
Shift+F6 |
Rename |
|
Ctrl+Alt+M / Cmd+Option+M |
Extract Method |
|
Ctrl+Alt+N / Cmd+Option+N |
Inline |
|
Ctrl+Alt+V / Cmd+Option+V |
Extract Variable |
|
Ctrl+F6 / Cmd+F6 |
Change Method Signature |
|
Ctrl+Alt+E / Cmd+Option+E |
Extract Interface |
|
F6 |
Move Class |
|
5. Search and Replace
Shortcut |
Function |
Example |
Ctrl+F / Cmd+F |
Find |
Search for a text string within the current file |
Ctrl+R / Cmd+R |
Replace |
|
Ctrl+Shift+F / Cmd+Shift+F |
Find in Path |
Search across the entire project |
Ctrl+Shift+R / Cmd+Shift+R |
Replace in Path |
|
6. Running and Debugging
Shortcut |
Function |
Example |
Shift+F10 |
Run |
Execute the application or test |
Shift+F9 |
Debug |
|
Ctrl+F8 / Cmd+F8 |
Toggle Breakpoint |
|
F8 |
Step Over |
|
F7 |
Step Into |
|
Shift+F8 |
Step Out |
|
Alt+F9 / Option+F9 |
Run to Cursor |
|
7. Version Control
Shortcut |
Function |
Example |
Ctrl+K / Cmd+K |
Commit Changes |
|
Ctrl+T / Cmd+T |
Update Project |
|
Alt+` / Option+` |
VCS Operations Popup |
|
Ctrl+Alt+Z / Cmd+Option+Z |
Revert Changes |
|
8. Miscellaneous
Shortcut |
Function |
Example |
Ctrl+Shift+A / Cmd+Shift+A |
Find Action |
|
Ctrl+Shift+F12 / Cmd+Shift+F12 |
Toggle Maximize Editor |
|
Ctrl+Shift+S / Cmd+Shift+S |
Save All |
|
Ctrl+Shift+Alt+T / Cmd+Shift+Option+T |
Surround With |
|
Conclusion
This guide covers a wide range of shortcuts available in IntelliJ IDEA.
Remember, these shortcuts may vary slightly depending on your operating system
and IntelliJ IDEA version. You can always check and customize shortcuts in
IntelliJ IDEA by going to File > Settings > Keymap (on Windows/Linux) or
IntelliJ IDEA > Preferences > Keymap (on macOS).
Practice these shortcuts regularly, and you'll find your productivity increasing
significantly as you become more proficient with IntelliJ IDEA. As you become
comfortable with these shortcuts, you may want to explore even more advanced
features and customizations available in IntelliJ IDEA.
Happy coding!
IDE,
IntelliJ,
Shortcuts
Related Topics
0 comments:
Post a Comment