This guide is intended to help you become more productive with IntelliJ IDEA, and provides an overview of the most important features, together with tips, tricks, and the hottest shortcuts.
User Interface
The IntelliJ IDEA Editor is special in a number of ways, most notable being is that you can invoke almost any IDE feature without leaving it, which allows you to organize a layout where you have more screen space because auxiliary controls like toolbars and windows are hidden.
Accessing a tool window via its shortcut moves the input focus to it, so you can use all keyboard commands in its context.
When you need to go back to the editor, press Esc.
Below is a list of shortcuts that invoke the tool windows you will most often need:
| Tool Window | Shortcut |
|---|---|
| Project | ⌘1 or ⌘1⌘1 or ⌘1⌥ 1, ⌥1 or ⌥1⌥ 1, ⌥1 or ⌥1 |
| Version Control | ActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindow |
| Run | ⌘4 or ⌘4⌘4 or ⌘4⌘4 or ⌘4⌥ 4, ⌥4 or ⌥4⌥ 4, ⌥4 or ⌥4 |
| Debug | ⌘5 or ⌘5⌘5 or ⌘5⌘5 or ⌘5⌥ 5, ⌥5 or ⌥5⌥ 5, ⌥5 or ⌥5 |
| Terminal | ⌥F12 or ⌥F12⌥F12 or ⌥F12⌥F12 or ⌥F12⌥ F12, ⌥F12 or ⌥F12⌥ F12, ⌥F12 or ⌥F12 |
| Editor | Esc |
When you want to focus on the code, try the Distraction Free Mode. It removes all toolbars, tool windows, and editor tabs. To switch to this mode, on the main menu select View | Enter Distraction Free Mode.
An alternative to the Distraction Free Mode may be hiding all tool windows by pressing ⇧⌘F12 or ⇧⌘F12⇧⌘F12 or ⇧⌘F12⇧⌘F12 or ⇧⌘F12^ ⇧ F12, ⌃⇧F12 or ⌃⇧F12^ ⇧ F12, ⌃⇧F12 or ⌃⇧F12. You can restore the layout to its default by pressing this shortcut once again.
The Navigation Bar is a compact alternative to the Project tool window. To access the Navigation Bar, press ⌘↑, ⌥↖, ⌘↑ or ⌥↖⌥↖ or ⌥↖⌥⌘B or ⌥⌘B⌥ Home, ⌥↖ or ⌥↖⌥ Home, ⌥↖ or ⌥↖.
Most components in IntelliJ IDEA (both tool windows and popups) provide speed search. This feature allows you to filter a list, or navigate to a particular item by using a search query.
When you don't know the shortcut for an action, try using the Find action feature by pressing ⇧⌘A or ⇧⌘A⇧⌘A or ⇧⌘A⌘3 or ⌘3^ ⇧ A, ⌃⇧A or ⌃⇧A^ ⇧ A, ⌃⇧A or ⌃⇧A. Start typing to find an action by its name, see its shortcut or call it.
Code Completion
When you access Basic Completion by pressing ⌃Space or ⌃Space⌃Space or ⌃Space⌃Space or ⌃Space^ Space, ⌃Space or ⌃Space⌥ Slash, ⌥/ or ⌥/, you get basic suggestions for variables, types, methods, expressions, and so on. When you call Basic Completion twice, it shows you more results, including private members and non-imported static members.
The Smart Completion feature is aware of the expected type and data flow, and offers the options relevant to the context. To call Smart Completion, press ⌃⇧Space or ⌃⇧Space⌃⇧Space or ⌃⇧Space⌥⇧Space or ⌥⇧Space⇧ ⌥ Space, ⌥⇧Space or ⌥⇧Space^ ⇧ Space, ^ ⌥ Slash, ⌃⇧Space, ⌃⌥/, ⌃⇧Space or ⌃⌥/. When you call Smart Completion twice, it shows you more results, including chains.
To overwrite the identifier at the caret, instead of just inserting the suggestion, press Tab. This is helpful if you're editing part of an identifier, such as a file name.
To let IntelliJ IDEA complete a statement for you, press ⇧⌘⏎ or ⇧⌘⏎⇧⌘⏎ or ⇧⌘⏎⇧⌘⏎ or ⇧⌘⏎^ ⇧ Enter, ⌃⇧⏎ or ⌃⇧⏎^ ⇧ Enter, ⌃⇧⏎ or ⌃⇧⏎. Statement Completion will automatically add the missing parentheses, brackets, braces and the necessary formatting.
If you want to see the suggested parameters for any method or constructor, press ⌘P or ⌘P⌘P or ⌘P⌃⇧Space or ⌃⇧Space^ ⇧ Space, ⌃⇧Space or ⌃⇧Space⇧ ⌥ P, ⌥⇧P or ⌥⇧P. IntelliJ IDEA shows the parameter info for each overloaded method or constructor, and highlights the best match for the parameters already typed.
The Postfix Completion feature lets you transform an already typed expression to another one based on the postfix you type after a period, the expression type, and its context.
Editor Basics
Since in IntelliJ IDEA you can undo refactorings and revert changes from Local History, it makes no sense to ask you to save your changes every time.
The most useful Editor shortcuts are:
| Action | Description |
|---|---|
| Move the current line of code | ⇧⌘↑ or ⇧⌘↑⇧⌘↑ or ⇧⌘↑⌥↑ or ⌥↑^ ⇧ Up, ⌃⇧↑ or ⌃⇧↑^ ⇧ Up, ⌃⇧↑ or ⌃⇧↑ ⇧⌘↓ or ⇧⌘↓⇧⌘↓ or ⇧⌘↓⌥↓ or ⌥↓^ ⇧ Down, ⌃⇧↓ or ⌃⇧↓^ ⇧ Down, ⌃⇧↓ or ⌃⇧↓ |
| Duplicate a line of code | ⌘D or ⌘D⌘D or ⌘D^ D, ⌃D or ⌃D⌘ D, ⌘D or ⌘D |
| Remove a line of code | ⌘⌫ or ⌘⌫⌘Y or ⌘Y⌘D or ⌘D^ ⇧ L, ⌃⇧L or ⌃⇧L |
| Comment or uncomment a line of code | ⌘/, ⌘NumPad /, ⌘/ or ⌘NumPad /⌘/, ⌘NumPad /, ⌘/ or ⌘NumPad /⌘/, ⌘NumPad /, ⌘/ or ⌘NumPad /^ Slash, ^ NumPad /, ^ Colon, ⌃/, ⌃NumPad /, ⌃:, ⌃/, ⌃NumPad / or ⌃:⌥ Semicolon, ⌥; or ⌥; |
| Comment a block of code | ⌥⌘/, ⌥⌘NumPad /, ⌃⇧/, ⌃⇧NumPad /, ⇧⌘/, ⇧⌘NumPad /, ⌥⌘/, ⌥⌘NumPad /, ⌃⇧/, ⌃⇧NumPad /, ⇧⌘/ or ⇧⌘NumPad /⌃⇧/, ⌃⇧NumPad /, ⇧⌘/, ⇧⌘NumPad /, ⌃⇧/, ⌃⇧NumPad /, ⇧⌘/ or ⇧⌘NumPad /⌃⇧/ or ⌃⇧/^ ⇧ Slash, ^ ⇧ NumPad /, ^ ⇧ Colon, ⌃⇧/, ⌃⇧NumPad /, ⌃⇧:, ⌃⇧/, ⌃⇧NumPad / or ⌃⇧:^ ⇧ Slash, ^ ⇧ NumPad /, ⌃⇧/, ⌃⇧NumPad /, ⌃⇧/ or ⌃⇧NumPad / |
| Find in the currently opened file | ⌘F or ⌘F⌘F, ⌥F3, ⌘F or ⌥F3^ F, ⌥ F3, ⌃F, ⌥F3, ⌃F or ⌥F3^ ⌥ S, ⌥ F3, ^ S, ⌃⌥S, ⌥F3, ⌃S, ⌃⌥S, ⌥F3 or ⌃S |
| Find and replace in the current file | ⌘R or ⌘R⌘R or ⌘R^ H, ⌃H or ⌃H⇧ ⌥ 5, ⌥⇧5 or ⌥⇧5 |
| Next occurrence | ⌘G or ⌘GF3, ⌃L, F3 or ⌃L⌘K or ⌘KF3, F3 or F3F3, ⌥ S, F3, ⌥S, F3 or ⌥S |
| Previous occurrence | ⇧⌘G or ⇧⌘G⇧F3, ⌃⇧L, ⇧F3 or ⌃⇧L⇧⌘K or ⇧⌘K⇧ F3, ⇧F3 or ⇧F3⇧ F3, ⌥ R, ^ R, ⇧F3, ⌥R, ⌃R, ⇧F3, ⌥R or ⌃R |
| Navigate between opened tabs | ⇧⌘], ⌃→, ⇧⌘] or ⌃→⌃→ or ⌃→⌘F6, ⌥⌘→, ⌘F6 or ⌥⌘→⌥ Right, ⌥→ or ⌥→⌥ Right, ^ X, N, ⌥→, ⌃X, N, ⌥→ or ⌃X, N ⇧⌘[, ⌃←, ⇧⌘[ or ⌃←⌃← or ⌃←⇧⌘F6, ⌥⌘←, ⇧⌘F6 or ⌥⌘←⌥ Left, ⌥← or ⌥←⌥ Left, ^ X, P, ⌥←, ⌃X, P, ⌥← or ⌃X, P |
| Navigate back/forward | ⌘[, ⌥⌘←, Button4 Click, ⌘[, ⌥⌘← or Button4 Click⌥⌘←, Button4 Click, ⌥⌘← or Button4 Click⌘[, Button4 Click, ⌘[ or Button4 Click^ ⌥ Left, Button4 Click, ⌃⌥←, Button4 Click, ⌃⌥← or Button4 Click^ ⌥ Left, Button4 Click, ⌃⌥←, Button4 Click, ⌃⌥← or Button4 Click ⌘], ⌥⌘→, Button5 Click, ⌘], ⌥⌘→ or Button5 Click⌥⌘→, Button5 Click, ⌥⌘→ or Button5 Click⌘], Button5 Click, ⌘] or Button5 Click^ ⌥ Right, Button5 Click, ⌃⌥→, Button5 Click, ⌃⌥→ or Button5 Click^ ⌥ Right, Button5 Click, ⌃⌥→, Button5 Click, ⌃⌥→ or Button5 Click |
| Expand or collapse a code block in the editor | ⌘ , ⌘=, ⌘ or ⌘=⌘ , ⌘=, ⌘ or ⌘=⌘ , ⌘=, ⌘ or ⌘=^ NumPad Plus, ^ Equals, ⌃ , ⌃=, ⌃ or ⌃=^ NumPad Plus, ^ Equals, ⌃ , ⌃=, ⌃ or ⌃= ⌘- or ⌘-⌘- or ⌘-⌘- or ⌘-^ NumPad -, ^ Minus, ⌃- or ⌃-^ NumPad -, ^ Minus, ⌃- or ⌃- |
| Create new... | ⌘N or ⌘N⌘N or ⌘N⌘N or ⌘N⌥ Insert, ^ N, ⌃N or ⌃N⌥ Insert, ^ N, ⌃N or ⌃N |
| Surround with | ⌥⌘T or ⌥⌘T⌥⌘T or ⌥⌘T⌥⌘Z or ⌥⌘Z^ ⌥ T, ⌃⌥T or ⌃⌥T^ ⌥ T, ⌃⌥T or ⌃⌥T |
| Highlight usages of a symbol | ⌘F7 or ⌘F7⌘F7 or ⌘F7⇧⌘U or ⇧⌘U^ ⇧ F7, ⇧ F12, ⌃⇧F7, ⇧F12, ⌃⇧F7 or ⇧F12^ F7, ⌃F7 or ⌃F7 |
To expand a selection based on grammar, press ⌥↑ or ⌥↑⌘W or ⌘W⌃⇧↑ or ⌃⇧↑^ W, ⌃W or ⌃W^ ⌥ W, ⌃⌥W or ⌃⌥W. To shrink it, press ⌥↓ or ⌥↓⇧⌘W or ⇧⌘W⌃⇧↓ or ⌃⇧↓^ ⇧ W, ⌃⇧W or ⌃⇧W^ ⇧ W, ⌃⇧W or ⌃⇧W.
IntelliJ IDEA can select more than one piece of code at a time. You can select/deselect any piece of code via ⌃G or ⌃G⌃G or ⌃G⌃G or ⌃G⌥ J, ⌥J or ⌥J⌥ J, ⌥J or ⌥J, or by clicking a code selection and pressing ⌃⇧G or ⌃⇧G⌃⇧G or ⌃⇧G⌃⇧G or ⌃⇧G⇧ ⌥ J, ⌥⇧J or ⌥⇧J⇧ ⌥ J, ⌥⇧J or ⌥⇧J.
Navigation
Recent files
Most of the time you work with a finite set of files, and need to switch between them quickly. A real time-saver here is an action called Recent Files invoked by pressing ⌘E or ⌘E⌘E or ⌘E⌘E or ⌘E^ E, ⌃E or ⌃E. By default, the focus is on the last accessed file. Note that you can also open any tool window through this action:

Navigate to Class is available by pressing ⌘O or ⌘O⌘N or ⌘N⇧⌘T or ⇧⌘T^ Comma, ⌃, or ⌃,⇧ ⌥ G, ⌥⇧G or ⌥⇧G and supports sophisticated expressions, including camel humps, paths, line navigate to, middle name matching, and many more. If you call it twice, it shows you the results out of the project classes.
Navigate to File works similarly by pressing ⇧⌘O or ⇧⌘O⇧⌘N or ⇧⌘N⇧⌘R or ⇧⌘R^ ⇧ N, ⌃⇧N or ⌃⇧N^ X, Ctrl F, ⌃X, ⌃F or ⌃X, ⌃F, but is used for files and folders. To navigate to a folder, end your expression with the Slash character.
Navigate to Symbol is available by pressing ⌥⌘O or ⌥⌘O⌥⇧⌘N or ⌥⇧⌘N⌥⌘O or ⌥⌘O^ ⇧ ⌥ N, ⌃⌥⇧N or ⌃⌥⇧N^ ⇧ ⌥ N, ⌃⌥⇧N or ⌃⌥⇧N and allows you to find a method or a field by its name.
Structure
When you are not switching between files, you are most probably navigating within a file. The simplest way to do it is to press ⌘F12 or ⌘F12⌘F12 or ⌘F12⌘O or ⌘O^ F12, ⌃F12 or ⌃F12^ F12, ⌃F12 or ⌃F12. The popup shows you the structure of a file, and allows you to quickly navigate to any of them:

Select In
If you need to open a file in a particular tool window (or Finder/Explorer), you can do so via the Select In action by pressing ⌥F1 or ⌥F1⌥F1 or ⌥F1⌥F1 or ⌥F1⌥ F1, ⌥F1 or ⌥F1⌥ F1, ⌥F1 or ⌥F1:

Navigation shortcuts include:
| Action | Shortcut |
|---|---|
| Search everywhere | Double Shift |
| Navigate to class | ⌘O or ⌘O⌘N or ⌘N⇧⌘T or ⇧⌘T^ Comma, ⌃, or ⌃,⇧ ⌥ G, ⌥⇧G or ⌥⇧G |
| Navigate to file | ⇧⌘O or ⇧⌘O⇧⌘N or ⇧⌘N⇧⌘R or ⇧⌘R^ ⇧ N, ⌃⇧N or ⌃⇧N^ X, Ctrl F, ⌃X, ⌃F or ⌃X, ⌃F |
| Navigate to symbol | ⌥⌘O or ⌥⌘O⌥⇧⌘N or ⌥⇧⌘N⌥⌘O or ⌥⌘O^ ⇧ ⌥ N, ⌃⌥⇧N or ⌃⌥⇧N^ ⇧ ⌥ N, ⌃⌥⇧N or ⌃⌥⇧N |
| Recent files | ⌘E or ⌘E⌘E or ⌘E⌘E or ⌘E^ E, ⌃E or ⌃E |
| File structure | ⌘F12 or ⌘F12⌘F12 or ⌘F12⌘O or ⌘O^ F12, ⌃F12 or ⌃F12^ F12, ⌃F12 or ⌃F12 |
| Select in | ⌥F1 or ⌥F1⌥F1 or ⌥F1⌥⌘W or ⌥⌘W⌥ F1, ⌥F1 or ⌥F1⌥ F1, ⌥F1 or ⌥F1 |
| Navigate to declaration | ⌘B, ⌘Button1 Click, Button2 Click, ⌘B, ⌘Button1 Click or Button2 Click⌘B, ⌘Button1 Click, Button2 Click, ⌘B, ⌘Button1 Click or Button2 ClickF3, ⌃Button1 Click, F3 or ⌃Button1 ClickF12, ⇧ F2, ^ B, ^ Button1 Click, Button2 Click, F12, ⇧F2, ⌃B, ⌃Button1 Click, Button2 Click, F12, ⇧F2, ⌃B, ⌃Button1 Click or Button2 Click^ ⌥ G, Escape, Period, ⌥ Period, ^ Button1 Click, ⌃⌥G, ⎋, ., ⌥., ⌃Button1 Click, ⌃⌥G, ⎋, ., ⌥. or ⌃Button1 Click |
| Navigate to type hierarchy | ⌃H or ⌃H⌃H or ⌃HF4 or F4⌥ H, ⌥H or ⌥H^ H, ⌃H or ⌃H |
| Show UML popup | ⌥⌘U or ⌥⌘U⌥⌘U or ⌥⌘U⌥⌘U or ⌥⌘U^ ⌥ U, ⌃⌥U or ⌃⌥U^ ⌥ U, ⌃⌥U or ⌃⌥U |
Quick Pop-Ups
Quick Pop-ups are helpful for checking additional information related to the symbol at the caret. Below is a list of pop-ups you should know if you want to be more productive:
| Action | Shortcut |
|---|---|
| Documentation | F1, ⌃J, ⌃Button2 Click, F1, ⌃J or ⌃Button2 Click⌃J, ⌃Button2 Click, ⌃J or ⌃Button2 Click⌥Button2 Click, F2, ⌥Button2 Click or F2^ Q, ⌃Q or ⌃Q^ Q, ⌥ Button2 Click, ⌃Q, ⌥Button2 Click, ⌃Q or ⌥Button2 Click |
| Quick definition | ⌥Space, ⌘Y, ⌥Space or ⌘Y⇧⌘I or ⇧⌘I⌥Space, ⌘Y, ⌥Space or ⌘Y^ ⇧ I, ⌃⇧I or ⌃⇧I^ ⇧ I, ⌃⇧I or ⌃⇧I |
| Show usages | ⌥⌘F7 or ⌥⌘F7⌥⌘F7 or ⌥⌘F7⌥⌘F7 or ⌥⌘F7^ ⌥ F7, ⌃⌥F7 or ⌃⌥F7^ ⌥ F7, ⌃⌥F7 or ⌃⌥F7 |
| Show implementation | ⌥⌘B, ⌥⌘Button1 Click, ⌥⌘B or ⌥⌘Button1 Click⌥⌘B, ⌥⌘Button1 Click, ⌥⌘B or ⌥⌘Button1 Click^ ⌥ B, ^ ⌥ Button1 Click, ⌃⌥B, ⌃⌥Button1 Click, ⌃⌥B or ⌃⌥Button1 Click |
Quick Pop-ups are available for symbols in the editor; however, they are also available for items in any other list via the same shortcuts.
Refactoring Basics
IntelliJ IDEA offers a comprehensive set of automated code refactorings that lead to significant productivity gains when used correctly. Firstly, don't bother selecting anything before you apply a refactoring. IntelliJ IDEA is smart enough to figure out what statement you're going to refactor, and only asks for confirmation if there are several possible choices.
To undo the last refactoring, switch the focus to the Project tool window and press ⌘Z or ⌘Z⌘Z or ⌘Z⌘Z or ⌘Z^ Z, ⌃Z or ⌃Z^ ⇧ Minus, ^ Slash, ⌃⇧-, ⌃/, ⌃⇧- or ⌃/.
Finding Usages
Find Usages helps you quickly find all pieces of code referencing the symbol at the caret (cursor), no matter if the symbol is a class, method, field, parameter, or another statement. Just press ⌥F7 or ⌥F7⌥F7 or ⌥F7⇧⌘G or ⇧⌘G⇧ ⌥ F7, ⌥⇧F7 or ⌥⇧F7⌥ F7, ⇧ ⌥ S, ⌥F7, ⌥⇧S, ⌥F7 or ⌥⇧S and get a list of references grouped by usage type, module, and file.
If you want to set custom options for the Find Usages algorithm, press ⌥⇧⌘F7 or ⌥⇧⌘F7⌥⇧⌘F7 or ⌥⇧⌘F7⌥⇧⌘F7 or ⌥⇧⌘F7^ ⇧ ⌥ F7, ⌃⌥⇧F7 or ⌃⌥⇧F7^ ⇧ ⌥ F7, ⌃⌥⇧F7 or ⌃⌥⇧F7, or click the first button on the right panel with search results.
If what you're looking for is plain text, use Find in Path by pressing ⇧⌘F or ⇧⌘F⌃⇧F or ⌃⇧F⌃H or ⌃H^ ⇧ F, ⌃⇧F or ⌃⇧F^ ⇧ F, ⌃⇧F or ⌃⇧F.
Inspections
Inspections are built-in static code analysis tools that help you find probable bugs, locate dead code, detect performance issues, and improve the overall code structure.
Most inspections not only tell you where a problem is, but also provide quick fixes to deal with it right away. Press ⌥⏎ or ⌥⏎⌥⏎ or ⌥⏎⌘1 or ⌘1⌥ Enter, ⌥⏎ or ⌥⏎⌥ Enter, ⌥⏎ or ⌥⏎ to choose a quick fix.
The editor lets you quickly navigate between the highlighted problems via keyboard shortcuts. Press F2 or F2F2 or F2⌘. or ⌘.F2, F2 or F2F2, ^ X, Back Quote, F2, ⌃X, `, F2 or ⌃X, ` to go to the next problem, and ⇧F2 or ⇧F2⇧F2 or ⇧F2⇧⌘. or ⇧⌘.⇧ F2, ⇧F2 or ⇧F2⇧ F2, ^ ⇧ X, Back Quote, ⇧F2, ⌃⇧X, `, ⇧F2 or ⌃⇧X, ` to go to the previous one.
Inspections that are too complex to be run on-the-fly are available when you perform code analysis for the entire project. You can do this in one of the following two ways: by selecting Analyze | Inspect Code from the main menu, or by selecting Analyze | Run Inspection by Name to run an inspection by its name.
Note that while inspections provide quick-fixes for code that has potential problems, intentions help you apply automatic changes to code that is correct. To get a list of intentions applicable to the code at the caret, press ⌥⏎ or ⌥⏎⌥⏎ or ⌥⏎⌘1 or ⌘1⌥ Enter, ⌥⏎ or ⌥⏎⌥ Enter, ⌥⏎ or ⌥⏎.
Code Style and Formatting
IntelliJ IDEA automatically applies a code style you've configured in the Code Style settings as you edit, and in most cases you don't need to call the Reformat Code action explicitly.
Useful formatting shortcuts:
| Action | Shortcut |
|---|---|
| Reformat code | ⌥⌘L or ⌥⌘L⌥⌘L or ⌥⌘L⇧⌘F or ⇧⌘F⌥ F8, ^ ⌥ F, ⌥F8, ⌃⌥F, ⌥F8 or ⌃⌥F |
| Auto-indent lines | ⌃⌥I or ⌃⌥I⌥⌘I or ⌥⌘I⌘I or ⌘I^ ⌥ I, ⌃⌥I or ⌃⌥I^ ⌥ I, ^ ⌥ Q, ⌃⌥I, ⌃⌥Q, ⌃⌥I or ⌃⌥Q |
| Optimize imports | ⌃⌥O or ⌃⌥O⌥⌘O or ⌥⌘O⇧⌘O or ⇧⌘O^ ⌥ O, ⌃⌥O or ⌃⌥O^ ⌥ O, ⌃⌥O or ⌃⌥O |
Note that by default, IntelliJ IDEA uses regular spaces for indents instead of tabs. If you have files with lots of indents, you may want to optimize their size by enabling the Use tab character option in the Java code style settings.
Version Control Basics
To check out a project from a Version Control System (VCS), click Checkout from Version Control on the Welcome Screen, or in the main VCS menu.
To quickly perform a VCS operation on the current file, directory, or an entire project, use the VCS operations popup by pressing ⌃V or ⌃V⌃V or ⌃V⌃V or ⌃V⌥ Back Quote, ⌥` or ⌥`⌥ Back Quote, ⌥` or ⌥`

Once you've configured the VCS settings, you'll see the Version Control tool window. You can switch to it anytime by pressing ActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindow.
The Local Changes tab of the Version Control tool window shows your local changes: both staged and unstaged.
Useful VCS shortcuts:
| Action | Shortcut |
|---|---|
| Version Control tool window | ActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindowActivateChangesToolWindow |
| VCS operations popup | ⌃V or ⌃V⌃V or ⌃V⌃V or ⌃V⌥ Back Quote, ⌥` or ⌥`⌥ Back Quote, ⌥` or ⌥` |
| Commit changes | ⌘K or ⌘K⌘K or ⌘K^ K, ⌃K or ⌃K^ K, ⌃K or ⌃K |
| Update project | ⌘T or ⌘T⌘T or ⌘T^ T, ⌃T or ⌃T^ T, ⌃T or ⌃T |
| Push commits | ⇧⌘K or ⇧⌘K⇧⌘K or ⇧⌘K⇧⌘K or ⇧⌘K^ ⇧ K, ⌃⇧K or ⌃⇧K^ ⇧ K, ⌃⇧K or ⌃⇧K |
Annotation (available from both the quick list, the main and the context menus) allows you to see who and when changed a line of code for any file.
Branches
To perform an operation on a branch, either select Branches from the VCS main or context menu, the VCS operations popup, or the widget on the right of the status bar.
Note that for multiple repositories, IntelliJ IDEA performs all VCS operations on all branches simultaneously, so you don't need to switch between them manually.
Shelves, stashes and patches help you when you need to store some of the local changes without committing them to the repository. You can then switch to the repository versions of the files, and then come back to your changes later.
Make
By default, IntelliJ IDEA doesn't automatically compile projects on saving. To compile a project, select Build | Make Project from the main menu and press ⌘F9 or ⌘F9⌘F9 or ⌘F9⌘B or ⌘BF7, F7 or F7^ F9, ⌃F9 or ⌃F9
Running and Debugging
Once you've created a Run/Debug configuration by selecting Run | Edit Configurations from the main menu, you are able to run and debug your code.
| Action | Shortcut |
|---|---|
| Run | ⌃R or ⌃R⇧F10 or ⇧F10⇧⌘F11 or ⇧⌘F11^ F5, ⌃F5 or ⌃F5⇧ F10, ⇧F10 or ⇧F10 |
| Debug | ⌃D or ⌃D⇧F9 or ⇧F9⌘F11 or ⌘F11⌥ F5, ⌥F5 or ⌥F5⇧ F9, ⇧F9 or ⇧F9 |
When in the debug mode, you can evaluate any expression by using the Evaluate expression tool, which is accessed by pressing ⌥F8 or ⌥F8⌥F8 or ⌥F8⌘U or ⌘U⌥ F8, ⌥F8 or ⌥F8⌥ F8, ⌥F8 or ⌥F8. This tool provides code completion in the same way as in the editor, so it's easy to enter any expression.
Sometimes, you may want to step into a particular method, but not the first one which will be invoked. In this case, use Smart step into by pressing ⇧F7 or ⇧F7⇧F7 or ⇧F7⌥F5 or ⌥F5⇧ F7, ⇧F7 or ⇧F7⇧ F7, ⇧F7 or ⇧F7 to choose a particular method.
| Action | Shortcut |
|---|---|
| Toggle breakpoint | ⌘F8 or ⌘F8⌘F8 or ⌘F8⇧⌘B or ⇧⌘BF9, F9 or F9^ F8, ⌃F8 or ⌃F8 |
| Step into | F7 or F7F7 or F7F5 or F5F11, F8, F11, F8, F11 or F8F7, F7 or F7 |
| Smart step into | ⇧F7 or ⇧F7⇧F7 or ⇧F7⌥F5 or ⌥F5⇧ F7, ⇧F7 or ⇧F7⇧ F7, ⇧F7 or ⇧F7 |
| Step over | F8 or F8F8 or F8F6 or F6F10, ⇧ F8, F10, ⇧F8, F10 or ⇧F8F8, F8 or F8 |
| Step out | ⇧F8 or ⇧F8⇧F8 or ⇧F8F7 or F7⇧ F11, ^ ⇧ F8, ⇧F11, ⌃⇧F8, ⇧F11 or ⌃⇧F8⇧ F8, ⇧F8 or ⇧F8 |
| Resume | ⌥⌘R or ⌥⌘RF9 or F9F8 or F8F5, F5 or F5F9, F9 or F9 |
| Evaluate expression | ⌥F8 or ⌥F8⌥F8 or ⌥F8⌘U or ⌘U⌥ F8, ⌥F8 or ⌥F8⌥ F8, ⌥F8 or ⌥F8 |
If you want to "rewind" while debugging, you can do it via the Drop Frame action. This is particularly helpful if you mistakenly stepped too far. This will no revert the global state of your application, but will at least let you revert to a previous stack frame.
Any breakpoint can be quickly disabled by clicking on the gutter while holding ⌥. To change breakpoint details (e.g. conditions), press ⇧⌘F8 or ⇧⌘F8⇧⌘F8 or ⇧⌘F8⇧⌘F8 or ⇧⌘F8⌥ F9, ⌥F9 or ⌥F9^ ⇧ F8, ⌃⇧F8 or ⌃⇧F8.
Reloading changes and hot swapping
Sometimes, you need to insert minor changes into your code without shutting down the process. Since the Java VM has a HotSwap feature, IntelliJ IDEA handles these cases automatically when you call Make.
Application Servers
To deploy your application to a server:
- Configure your artifacts by selecting File | Project Structure | Artifacts (done automatically for Maven and Gradle projects).
- Configure an application server by selecting File | Settings | Application Servers.
- Configure a run configuration by selecting Run | Edit Configurations, then specify the artifacts to deploy and the server to deploy them to.
You can always tell IntelliJ IDEA to build/rebuild your artifacts (once they have been configured) by selecting Build | Build Artifacts.
When you need to apply changes in the code to a running application, in addition to Make, you can use the Update action by pressing ⌘F10 or ⌘F10⌘F10 or ⌘F10⌘F10 or ⌘F10^ F10, ⌃F10 or ⌃F10^ F10, ⌃F10 or ⌃F10. This action is only available for the Exploded artifact type. Based on your choice, it can update resources or update classes and resources. When the Update action is applied in the Debug mode, it uses HotSwap; otherwise, it uses Hot redeployment.
Working with Build Tools (Maven/Gradle)
Once you've imported/created your Maven/Gradle project, you are free to edit its pom.xml/build.gradle files
directly in the editor. Any changes to the underlying build configuration will eventually need to be synced with the project
model in IntelliJ IDEA.
If you want the IDE to synchronize your changes immediately, do the following:
-
For
pom.xmlenable the Import Maven projects automatically option in File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing. -
For
build.gradle, enable the Use auto-import option in Settings | Build, Execution, Deployment | Build Tools | Gradle.
For manual synchronization, use the corresponding action on the Maven/Gradle tool window toolbar:
.
Note that any goal or task can be attached to be run before a run configuration.
