IntelliJ IDEA快捷键

Search Everywhere  Double Shirt

Go to File  Ctrl+Shift+N

Recent Files  Ctrl+E

Navigation Bar  Alt+Home

The Code Completion feature lets you quickly complete different kinds of statements in the code. For example, start typing a class name and press Ctrl+空格 to complete it. When multiple choices are available, they are shown in the lookup list.   

Edit | Find | Find Usages  Alt + F7

View | Quick Documentation  Ctrl+Q

To navigate to the declaration of a class, method or variable used somewhere in the code, position the caret at the usage and press Ctrl+B  (Navigate | Declaration). You can also click the mouse on usages with the Ctrl key pressed to jump to declarations.

You can quickly navigate in the currently edited file with Ctrl+F12 (Navigate | File Structure).  It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key.    To easily locate an item in the list, just start typing its name.   

place the caret at the symbol you want to rename, and press Shift+F6 (Refactor | Rename). Type the new name in the popup window that appears, or select one of the suggested names, and press Enter.

You may easily override methods of the base class by pressing Ctrl+O (Code | Override Methods).    To implement methods of the interfaces that the current class implements (or of the abstract base class), use Ctrl+I (Code | Implement methods).   

The SmartType code completion greatly helps to find methods and variables that are suitable in the current context, by analyzing the expected type of the whole expression. So doing, IntelliJ IDEA pinpoints the top five most suitable results and highlights them on the green background. type code then press Ctrl+Shift+空格

When using Code Completion, you can accept the currently highlighted selection in the popup list with Tab key.

Unlike accepting with the Enter key, the selected name will overwrite the rest of the name to the right of the caret. This can be especially useful for replacing one method or variable name with another.

Did you know that you can close tabs in the editor and the tool windows of IntelliJ IDEA without actually using the context menu commands? It is enough to point with your mouse cursor to a tab to be closed, and click the middle mouse button, or just use the Shift+click combination.

Using Alt+Insert (Code | Generate) in the editor, you can easily generate getter and setter methods for any fields of your class.

To quickly select the currently edited element (class, file, method or field) in any view (Project view, Structure view or other), press Alt+F1.

The Esc key in any tool window moves the focus to the editor.    Shift+Esc moves the focus to the editor and also hides the current (or last active) tool window.    The F12 key moves the focus from the editor to the last focused tool window.   

When you want to catch exceptions thrown by some code fragment, select it in the editor, press Ctrl+Alt+T (Code | Surround With) and choose try / catch. The catch blocks for all the exceptions thrown inside the block will be generated automatically.    You can customize the bodies of the generated catch blocks on the Code tab of File | Settings | File and Code Templates.    Use other items in the list to surround with other constructs.   

The SmartType code completion may be used after the new keyword, to instantiate an object of the expected type. For example, type "StringBuffer buffer = new" and press Ctrl+Shift+空格

To navigate to the implementation(s) of an abstract method, position the caret at its usage or its name in the declaration and press Ctrl+Alt+B.

Ctrl+W (extend selection) in the editor selects the word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc. You can also select the word at the caret and the expanding areas of the source code by double-clicking the target areas in the editor.

The Extract Variable refactoring helps you simplify complicated statements in your code. select an expression in the code and press Ctrl+Alt+V (Refactor | Extract | Variable...).  

You can comment or uncomment lines and blocks of code using Ctrl+斜杠 and Ctrl+Shift+斜杠.

Ctrl+斜杠 comments or uncomments the current line or selected block with single line comments (//...).

Ctrl+Shift+斜杠 encloses the selected block in a block comment (/*...*/).

To uncomment a commented block press Ctrl+Shift+斜杠 anywhere inside it.

When you need to cast an expression value to the required type the SmartType code completion will help you. For example, type
String s = (<caret is here>

and press Ctrl+Shift+空格 to see what happens.

Ctrl+D in the editor duplicates the selected block or the current line when no block is selected.

Live Templates allow you to generate many typical code constructs in seconds! For example, type
String[] array1, array2;
itar
in a method and press the Tab key to see what happens. Use the Tab key to move between the template fields. See File | Settings | Live Templates for more details.      

The CodeCompletion feature can suggest a name for a variable when you declare it. For example, start typing
private FileOutputStream
and press Ctrl+空格.

If the cursor is between the parentheses of a method call, pressing Ctrl+P brings up a list of valid parameters.

Ctrl+Shift+Backspace (Navigate | Last Edit Location) brings you back to the last place where you made changes in the code.

Pressing Ctrl+Shift+Backspace a few times moves you deeper into your changes history.

Use Ctrl+Shift+F7 (Edit | Find | Highlight Usages in File) to quickly highlight usages of some variable in the current file.

Use F3 and Shift+F3 keys to navigate through highlighted usages.

Press Esc to remove highlighting.

Use Code | Reformat Code to reformat code according to your code style preferences (File | Settings | Code Style).

You can also use Code | Optimize Imports to automatically optimize imports (remove unused imports, etc.). To access the corresponding settings, use File | Settings | Code Style | Imports.

To see your local history of changes in a file, invoke Local History | Show History from the context menu. You can navigate through different file versions, see the differences and roll back to any previous version.

Use the same context menu item to see the history of changes on a directory. You will never lose any code with this feature!

Press Alt+Q (View | Context Info) to see the declaration of the current method without the need to scroll to it.

Ctrl+E (View |  Recent Files) brings a popup list of the recently visited files. Choose the desired file and press Enter to open it.

Besides recent files, you can bring up results of the usage searches you have performed recently. To do that, use the same Ctrl+E shortcut with the Find tool window having the focus, and select the desired find usages result from the Recent Find Usages popup.

Use F2/Shift+F2 keys to jump between highlighted syntax errors.

Use Ctrl+Alt+向上箭头/Ctrl+Alt+向下箭头 shortcuts to jump between compiler error messages or search operation results.

To skip warnings right click on the validation side bar / marker bar and choose Go to high priority problems only.

Use Ctrl+J to complete any valid Live Template abbreviation if you don't remember it. For example, type it and press Ctrl+J to see what happens.

To show separator lines between methods in the editor, open the editor settings and select the Show method separators check box in the Appearance page.

When using basic code completion (Ctrl+空格), type any characters that exist anywhere in an identifier.

Use Alt+向上箭头 and Alt+向下箭头 keys to quickly move between methods in the editor.

Ctrl+Shift+J shortcut joins two lines into one and removes unnecessary space to match your code style.

Use Refactor | Copy to create a class which is a copy of the selected class. This can be useful, for example, when you need to create a class which has much in common with some existing class and it's not feasible to put the shared functionality in a common superclass.

Use the Ctrl+Shift+V shortcut to choose and insert recent clipboard contents into the text.

To see the inheritance hierarchy for a selected class, press Ctrl+H (Navigate | Type Hierarchy). You can also invoke the hierarchy view right from the editor to see the hierarchy for the currently edited class.

Right-clicking on a breakpoint marker (on the bar to the left from the text) invokes the speedmenu where you can quickly enable/disable the breakpoint or adjust its properties.

To easily evaluate the value of any expression while debugging the program, select its text in the editor (you may press a Ctrl+W a few times to efficiently perform this operation) and press Alt+F8.

To quickly evaluate the value of any expression while debugging the program, hold Alt and click this expression to see its value and calculate it, call a method, etc.

Use Basic Completion (Ctrl+空格) for completing words in text and comments in files of many different types.    All the words from the current file that start with the typed prefix will appear in the lookup list. 

The shortcuts such as Ctrl+Q (View | Quick Documentation), Ctrl+P (View | Parameter Info), Ctrl+B (Navigate | Declaration) and others can be used not only in the editor but in the code completion popup list as well.

When using Code Completion, you can accept the currently highlighted selection in the popup list with the period character (.), comma (,), semicolon (;), space and other characters.    The selected name is automatically entered in the editor followed by the entered character.   

For the pattern search in the Go to Class, Go to Symbol and Go to File pop-up frames, use * and space symbols.
* stands for any symbol.
Space at the end means the end of a pattern, and the preceding string will be considered not just a prefix but a whole pattern. The list of the suggested names will be reduced accordingly.

When you invoke the Move refactoring (F6) on an inner class that is declared static, you are provided with an option to either make it a top-level class, or move it to another class.

You can use the Extract Variable refactoring even  on incomplete statements. Just press Ctrl+Alt+V,  and choose the desired expression

To open any particular method or field in the editor quickly, press Ctrl+Alt+Shift+N (Navigate | Symbol) and start typing its name.    Choose symbol from the drop-down list that appears.   

Use Alt+Shift+C to quickly review your recent changes to the project.

Use Basic Completion (Ctrl+空格) within HTML, CSS and other files, for completing image file names.

With a single keystroke, you can apply another code style/coloring scheme or keymap right from the editor. Just press Ctrl+后引号 (View | Quick Switch Scheme), to specify the scheme you want to change.

Use Ctrl+Shift+Enter to complete a current statement such as if, do-while, try-catch, return (or a method call) into a syntactically correct construct (e.g. add curly braces).

Use Ctrl+Shift+I (View | Quick Definition), to quickly review definition or content of the symbol at caret, without the need to open it in a new editor tab.

You can use Basic Completion (Ctrl+空格) in HTML, CSS and JavaScript files, for completing attributes, parameters, tags, selectors, etc.

The Code | Move Statement Up/Down action is useful for reorganizing the code lines in your file, e.g., for bringing a variable declaration closer to variable usage.

Select a code fragment and press Ctrl+Shift+向上箭头 or Ctrl+Shift+向下箭头.

By pressing Alt+Shift+F10 you can access the Run/Debug dropdown on the main toolbar, without the need to use your mouse.

The Quick Definition Viewer (Ctrl+Shift+I) can also be used for items in lookup lists that appear on code completion and class/file/symbol navigaton commands.

Navigation bar is a quick alternative to the Project view.    Use Alt+Home keyboard shortcut to show the navigation bar, and arrow keys to locate the necessary files or folders.   

The Changes tool window shows all deleted, modified, and unversioned files in a single view. Use Alt+9 keyboard shortcut to show or hide this tool window.

From the Changes tool window you can perform all the necessary version control actions: commit changes, manage changelists, put resources under version control, examine differences and more.

You can quickly open a Maven project by selecting a pom.xml file in the File | Open dialog. The corresponding Maven project is imported with default settings, without launching the wizard.

You can quickly open an Eclipse project by selecting a .classpath or .project file in the File | Open dialog. The corresponding Eclipse project is imported with default settings, without launching the wizard.

To quickly find a menu command or toolbar action, you do not need to look through the menus. Just press Ctrl+Shift+A (Help | Find Action on the main menu) and start typing the name of the action. Choose the desired action from the suggestion list.

To quickly find and run an inspection, press Ctrl+Alt+Shift+I and start typing the name of the inspection or its group. Choose the desired inspection from the suggestion list and then specify the desired scope.

To view all exit points of a method, place the caret at one of them, e.g. the return statement, and press Ctrl+Shift+F7

You can view all statements within the method where certain exceptions can be caught. Just place the caret at the throws  keyword in a method declaration, press Ctrl+Shift+F7 and select the desired exception class from the list. This will also work for try and catch.  

When you press Alt+Enter to invoke a quick fix or intention action, press the right arrow key to reveal the list of additional options.    Depending on the context, you can choose to disable inspection, fix all problems, change inspection profile, etc.   

You can easily make column selection by dragging your mouse pointer while keeping the Alt key pressed.

If nothing is selected in the editor, and you press Ctrl+C, then the whole line at caret is copied to the clipboard.

Use the Switcher (Ctrl+Tab) to switch between open files and tool windows. Keeping Ctrl pressed, use the Up and Down arrow keys, Tab or Shift+Tab, Alt for navigation; use Delete or BackSpace to close editor tab or hide a tool window.

There are two ways of closing all tabs in the editor, except the current one:    First, right-click the editor tab, and choose Close Others on the context menu.  Second, keeping the Alt key pressed, click X on the editor tab.    

It is very easy to toggle between find and replace functionality.

When you perform search and replace in a file, pressing Ctrl+F shows the search pane. Pressing Ctrl+R adds field, where you can type the replace string.

While in the Find in Path dialog, you can switch to replace by pressing Ctrl+Shift+R. Same way, press Ctrl+Shift+F to hide the Replace with field, and switch to mere search.

IntelliJ IDEA allows you to search through the classes, files, tool windows, actions, settings, and symbols of your project by double pressing the Shift key.

When using autopopup Code Completion, you can select the first item using Ctrl+句点. The selected name is automatically entered in the editor followed by dot.

To select multiple words, press Alt+Shift, place the caret at each word to be selected and double-click the left mouse button.

You can quickly get familiar with the main features of the IDE by reading these tips. You may try out the features described in the tips while this dialog stays open on the screen. If you close the dialog, you can always get back to it from the Help | Tip of the Day main menu item.
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值