(转) IDEA操作技巧

 

本文系转载   原文见:https://blog.csdn.net/qq_32851113/article/details/80755944  

下面有部分没有翻译,仅作参考:

1.To open any class in the editor quickly, press Ctrl+N (Navigate | Class) and start typing the name of the class. Choose the class from a drop-down list that appears.

要快速打开编辑器中的任何类,请按Ctrl+N(导航|)并开始输入类的名称。从出现的下拉列表中选择类。

You can open any file in your project in a similar way by using Ctrl+Shift+N (Navigate | File)

您可以使用Ctrl+Shift+N以类似的方式打开项目中的任何文件(导航|文件)

2.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.

代码完成特性允许您快速完成代码中的不同类型的语句。例如,输入一个类名并按Ctrl +空格来完成它。当多个选项可用时,它们将显示在查找列表中。

 

3.You can quickly find all places where a particular class, method or variable is used in the whole project by positioning the caret at the symbol's name or at its usage in code and pressing Alt+F7 (Edit | Find | Find Usages in the popup menu).

您可以通过将插入符号定位到符号的名称或在代码中的用法,并按Alt+F7(编辑|,找到弹出菜单中的|查找用法),快速找到在整个项目中使用特定类、方法或变量的所有位置。

4.To quickly see the documentation for a class or method at caret, press Ctrl+Q (View | Quick Documentation).

要在插入符号中快速查看类或方法的文档,请按Ctrl+Q(查看|快速文档)

 

5.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.

要导航到代码中某个地方使用的类、方法或变量的声明,请将插入符号放置在使用位置并按Ctrl+B(导航|声明)您还可以使用Ctrl键单击鼠标,以跳转到声明。

 

6.You can easily rename your classes, methods and variables with automatic correction of all places where they are used.To try it, 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.

您可以轻松地重命名您的类、方法和变量,并自动纠正所有使用它们的地方。

要尝试,将插入符号放在要重命名的符号上,然后按Shift+F6(重构| rename)。在出现的弹出窗口中键入新名称,或选择其中一个建议的名称,然后按Enter

 

7.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).

您可以通过按Ctrl+O(代码|覆盖方法)轻松覆盖基类的方法。

要实现当前类实现的接口(或抽象基类的接口)的方法,请使用Ctrl+I(代码|实现方法)

8.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 blue background. For example, type

SmartType代码补全通过分析整个表达式的预期类型,极大地帮助查找适合当前上下文的方法和变量。这样做,IntelliJ IDEA就能找到最适合的五个结果,并在蓝色背景上突出它们。例如,类型

and press Ctrl+Shift+空格:

The SmartType completion also works after the return keyword, in an assignment, in an argument list of a method call and other places.

SmartType补全还可以在return关键字之后,在赋值中,在方法调用的参数列表和其他地方。

9.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.

当使用代码完成时,您可以使用Tab键接受弹出列表中当前突出显示的选择。

与接受输入键不同,选择的名称将覆盖到插入符号右侧的其他名称。这对于用另一个方法或变量名替换一个方法或变量名特别有用。

10.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.

你知道吗,你可以关闭编辑器和IntelliJ IDEA的工具窗口中的标签,而不用使用上下文菜单命令?只需将鼠标指针指向要关闭的选项卡,然后单击鼠标中键,或者使用Shift+单击组合即可。

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

在编辑器中使用Alt+Insert(代码|生成),您可以轻松地为类的任何字段生成gettersetter方法。

 

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

要在任何视图(项目视图、结构视图或其他视图)中快速选择当前编辑的元素(类、文件、方法或字段),请按Alt+F1

 

13.The speed search is available in all the tree views: just start typing and you'll quickly locate the necessary item.

在所有树视图中都可以找到速度搜索:只要开始键入,就可以快速找到必要的条目。

14.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.

任何工具窗口中的Esc键将焦点移动到编辑器。

Shift+Esc将焦点移动到编辑器,并隐藏当前(或最后一个活动)工具窗口。

F12键将焦点从编辑器移动到最后一个焦点工具窗口。

15.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.

当您希望捕获由某些代码片段抛出的异常时,请在编辑器中选择它,按Ctrl+Alt+T(代码| around With),然后选择try / catch。块中抛出的所有异常的catch块将自动生成。

可以在File | Settings | FileCode模板的Code选项卡上定制生成的catch块的主体。

使用列表中的其他项来包围其他构造。

 

16.The SmartType code completion may be used after the new keyword, to instantiate an object of the expected type. For example, type

SmartType代码完成可以在new关键字之后使用,以实例化预期类型的对象。例如,类型

and press Ctrl+Shift+空格:

17.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+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.

编辑器中的Ctrl+W(扩展选择)选择插入符号处的单词,然后选择源代码的展开区域。例如,它可以选择一个方法名,然后是调用这个方法的表达式,然后是整个语句,然后是包含块等等。

18.The Extract Variable refactoring helps you simplify complicated statements in your code. For example, in the code fragment below, you can select an expression in the code:

提取变量重构可以帮助您简化代码中的复杂语句。例如,在下面的代码片段中,您可以在代码中选择一个表达式:

and press Ctrl+Alt+V (Refactor | Extract | Variable...). This will result in the following:

Ctrl+Alt+V(重构|提取|变量…)这将导致下列情况:

19.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.

您可以使用Ctrl+/Ctrl+Shift+/注释或取消注释行和代码块。

Ctrl+/ comments或取消对当前行或选定块的注释(//…)

Ctrl+Shift+/将选中的块放在一个块注释中(/*…*/)

要取消注释,请按Ctrl+Shift+/任何地方。

20.When you need to cast an expression value to the required type the SmartType code completion will help you. For example, type

当您需要将表达式值转换为所需的类型时,SmartType代码完成将对您有所帮助。例如,类型

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

并按Ctrl + Shift +空格看看会发生什么。

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

在编辑器中按Ctrl+D复制选中的块或当前行,但没有选择任何块。

22.Live Templates allow you to generate many typical code constructs in seconds! For example, type

动态模板允许您在几秒钟内生成许多典型的代码构造!例如,类型

in a method and press the Tab key to see what happens.

在方法中,按Tab键查看发生了什么。

Use the Tab key to move between the template fields. See File | Settings | Live Templates for more details.

使用Tab键在模板字段之间移动。有关详细信息,请参阅文件|设置| Live模板。

23.The CodeCompletion feature can suggest a name for a variable when you declare it. For example, start typing

当您声明一个变量时,CodeCompletion特性可以提示一个变量的名称。例如,开始打字

and press Ctrl+空格.

You can customize name prefixes for local variables, parameters, instance and static fields in File | Settings | Code Style.

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

如果游标位于方法调用的圆括号之间,按Ctrl+P将显示有效参数列表。

25.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.

Ctrl+Shift+Backspace(导航|最后一个编辑位置)让您回到您在代码中进行更改的最后一个位置。

按下Ctrl+Shift+Backspace几下,你就能更深入地了解更改历史。

26.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.

27.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.

28.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!

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

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

31.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.

32.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.

33.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.

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

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

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

37.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.

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

39.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.

40.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.

41.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.

42.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.

43.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.

44.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.

45.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.

46.To help you learn the purpose of each item in the main menu, its short description is shown in the status bar at the bottom of the application frame when you position the mouse pointer over this item.

47.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 symbols.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.

48.When you invoke the Move refactoring (F6) on a nested 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.

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

50.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.

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

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

53.You can start referring to an Ant property or target even if it is not defined yet. An intention action feature will suggest you to automatically create the necessary tag, without the need for you to leave your current editing location.

54.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.

55.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).

56.When in the Go to Class, Go to Symbol, or Go to File popup, you can ease the search by filtering the lookup list with the help of the "camel words" prefixes.

57.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.

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

 

59.The Edit | Copy Reference action can be used to insert a reference to a field/method/class/file into the current position in the editor.For example, go to the java.util.Collections JDK class, place the cursor within the EMPTY_MAP field and press Ctrl+Alt+Shift+C:

Then return to your source code and press Ctrl+V:

You can also copy references in the GotoClass/GotoSymbol/GotoFile dialogs. Just press Ctrl+C on any element in the lookup list.

60.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.

61.Select a code fragment and press Ctrl+Shift+向上箭头 or Ctrl+Shift+向下箭头.The following pictures show an initial location of a code fragment, and the results of moving the selected fragment up and down.

When nothing is selected in the editor, the line at the cursor will be moved.

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

63.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.

64.You can use Basic Completion (Ctrl+空格) within Java String literals and in other file types, for completing .properties keys.

65.You can quickly review all styles currently applied to an HTML tag, by right-clicking the tag name and selecting Show Applied Styles For Tag from the context menu:

66.You can quickly view the image referenced at caret by using the Quick Definition (Ctrl+Shift+I). The underlying image will be opened in a popup instead of a separate editor tab.

67.It is possible to rename CSS selectors directly from HTML. Position the caret at the selector to be renamed and press Shift+F6 (Refactor | Rename).

68.Navigation bar is a quick alternative to the Project view.

69.Use Alt+Home keyboard shortcut to show the navigation bar, and arrow keys to locate the necessary files or folders.

70.The Version Control tool window shows all deleted, modified, and unversioned files in a single view. Use  keyboard shortcut to show or hide this tool window.From the Version Control tool window you can perform all the necessary version control actions: commit changes, manage changelists, put resources under version control, examine differences and more.

71.If you notice that IntelliJ IDEA works slowly, consider the possibility to reduce the number of folders under antivirus protection.Each antivirus check in your project consumes resources. You can significantly improve the performance, if you exclude certain folders from the antivirus protection.

72.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.

73.If you don't want to commit some of your changes to the repository, you can set them aside for a while, by moving to a separate changelist, or by putting them to a shelf. Select such file in the Local tab of the Changes tool window, and on the context menu choose Move to Another Changelist, or Shelve Changes.

74.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.

75.You can bring forward the list of all usages of a class, method or variable across the whole project, and quickly jump to the selected usage. To do that, place the caret at the symbol's name or at its usage in code and press Ctrl+Alt+F7 (Edit | Find | Show Usages in the main menu), scroll the list and click the desired usage.

76.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.

77.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.

78.You can quickly find a setting you need in the Settings/Preferences dialog, without browsing through the numerous options. Just type some characters that, in your opinion, exist in the option description, and the list of settings will reduce to the matching ones. Select the desired entry, and see the setting that contains the entered characters highlighted:

79.You can create code constructs using statement completion. Start typing a method declaration or a statement, and press Ctrl+Shift+Enter after the opening parenthesis. The braces are created, with the caret placed inside:

80.You can view all methods of the implemented interfaces in a class, if you place the caret at the implements keyword in the class declaration, press Ctrl+Shift+F7, and select the desired interface from the list:

81.When searching for a text string in a file, use recent history: with the search pane already open, click the down arrow to show the list of recent entries.

82.When you are finding text in the current file (Ctrl+F), you don't need to type the whole search string: Basic Code Completion is available in the search field. Start typing, press Ctrl+空格, and select the desired string from the suggestion list.

83.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:

84.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.

85.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.

86.Ctrl+Click (on Windows) or Cmd+Click (on MacOS) a tab in the editor to navigate to any part of the file path. Select the necessary element in the drop-down, and the corresponding file path opens in an external browser (e.g., in the Explorer, if your OS is Windows).

87.IntelliJ IDEA lets you jump from your check-in comment to an issue in your task tracker.All you have to do is to define issue navigation patterns in the Settings | Version Control | Issue Navigation dialog:

When you commit a changelist, and type the check-in comment, make sure it matches one of your issue navigation patterns. Later, when you browse through the changelists in the repository, such comments turn into hyperlinks:

Clicking a hyperlink brings you directly to an issue in your task tracker.

88.IntelliJ IDEA simplifies your work with colors in CSS files. The color properties have the icons of the corresponding color in the left gutter area of the editor.Click color icons to choose the desired color from the color picker.

89.IntelliJ IDEA helps create test cases directly from class declaration. With the caret at the class name in the editor, press Alt+Enter, and choose Create Test from the suggestion list:

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

91.You don't need to guess which index.html file you are looking at...Make the editor tabs and lines in navigation lists stand out using the File Colors page of the project settings.

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

93.You can move any file to a changelist of your choice. To do that, just choose Move to Another Changelist on the file context menu in the Version Control tool window:

94.Keep your source code typo-free with the help of the built-in Spellchecker.All texts, including comments, textual strings and literals, are inspected against the pre-defined dictionaries. All typos are highlighted, which leaves you with the task of choosing the correct word, accepting the current spelling, or disabling inspection.Use Alt+Enter to see the list of available actions.

95.If you lack words in the pre-defined dictionaries, you can create your own ones. A custom dictionary is a mere textual file with a .dic extension, with each word starting on a new line.All you have to do is to point to the directories where your dictionaries are stored, in the Spelling of the Settings dialog.

96.All your most indispensable VCS commands are just one-click away...Choose VCS | VCS Operations Popup on the main menu, and get a popup with the VCS commands that are relevant to the current context:

97.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.

98.You can easily open an external file for editing, if you just drag it from the Explorer or Finder to the editor.

99.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  on the editor tab.

100.You can jump directly to any deeply buried file, if you press Ctrl+Shift+N, and type just a couple of characters of the enclosing directories and file names:

Use either a slash or a backslash as a delimiter.

101.To open any class or file in the editor at the desired line, press Ctrl+Shift+N (Navigate | File), start typing the name, and choose the one from the suggestion list. Then type the colon (:) and a line number.The selected file will open with the caret at the specified line.

102.Version control annotations show the latest changes of each line in one click.Just right-click an annotation and use the Show Diff command in the context menu.

103.To compare two directories, select one or both of them in the Project view and press Ctrl+D.

104.To compare two jar files, select one or both of them in the Project view and press Ctrl+D.

105.If you need more workspace, you can hide the tool windows bars: click   in the lower left corner.If necessary, you can show the tool window buttons just for a moment. To do that, press the key Alt (for Windows/*nix) or Command (for Mac) twice and keep it down. While the key is pressed, the tool window buttons are visible.

106.You can exclude any file from your project. As a result, such a file will be ignored by indexing, inspection and code completion.In the Project tool window, select the file you want to ignore, and choose Mark as plain text in its context menu.If necessary, you can always return the file to its original type using the Mark as <file type> context menu command.

107.When using basic code completion (Ctrl+空格), you don't need to type upper-case letters in CamelHump names. It is enough to type the initial letters of the camel names in lower case, and they will be smartly recognized.

108.The keyboard shortcut Ctrl+K enables you to quickly invoke the Commit Changes dialog.This dialog shows all modifications in project, gives summary information of file status and suggests improvements before check-in.

109.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.

110.If you are working on a large project, with numerous TODO items, filter them by scopes.Use the Scope-Based tab in the TODO tool window to show only those items that pertain to the scope of interest.

111.TODO tool window lets you preview each of the encountered TODO items - just click the preview button on the toolbar.

112.If a method signature has been changed, IntelliJ IDEA highlights the tags that ran out of sync with the documentation comment and suggests a quick fix:

113.When working with a lengthy list of tasks, you don't need to delete them one by one. Select several tasks, using Shift or Control/Command keys, click the right arrow, and then click Remove.

114.If there are too many run/debug configurations of the same type, you can group them into folders, and thus distinguish them visually.

115.In the Live Templates settings, use speed search to find templates with certain text in the template abbreviation, body or description.Start typing the desired text, and the list of available templates will shrink to show matching templates only:

116.You can avoid escaping backslashes in your regular expressions. Start typing a regular expression, then press Alt+Enter and choose Edit RegExp. The regular expression opens in a separate tab in the editor, where you can type backslashes as is.All changes are synchronized with the original regular expression, and escapes are presented automatically. When ready, just press Esc to close the regular expression editor.

117.Speed up HTML, XML or CSS development with Emmet.Enable this framework in the corresponding page of the Editor | Emmet node (Settings/Preferences):

118.To view which line separators style is used in the current file, look at the Status Bar:

To change the current line ending style, just click the spinner.

119.You do not need to open a file in the editor to change its line separator style. Use the Project tool window instead: select one or more files, or folders, point to File | Line Separators on the main menu, and then choose the desired line ending style.For a directory, new line separator applies recursively.

120.If you place the caret at certain symbol and press Ctrl+Alt+Shift+T, you will see the list of refactorings applicable to the current context.

121.You want your bookmarks and breakpoints to be always at hand, so that you can easily navigate through them?

They are visible in the Favorites tool window, which you can dock or float as required:

122.You can drag an external file from the Explorer or Finder, and drop it onto the Favorites tool window.

123.Tune the IntelliJ IDEA tool windows layout to make better use of your screen.Toggle between the vertical and side-by-side placement of the tool windows by Ctrl+Click/Cmd+Click on the splitter:

124.You don't need to leave IntelliJ IDEA to work with your favorite shell. Just click the Terminal tool window button, and enjoy using the embedded local terminal.

125.For the embedded local terminal, you can define your favorite shell, default tab name, and other settings. Choose File | Settings on the main menu, and then open the page Terminal.

126.Enable the horizontal scrolling with the mouse wheel by holding the Shift key.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.

127.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.

128.When an autopopup completion is active, Ctrl+向下箭头 and Ctrl+向上箭头 will close it and move the caret down or up in the editor.

129.When in the Code Completion lookup, you can ease the search by filtering the list with the help of the "camel words" prefixes.

130.Pressing the same shortcut after you have invoked Smart-type Completion when there's an array of expected type in context will suggest to get an element from this array.

131.Pressing the same shortcut after you have invoked Smart-type Completion when a collection type is expected will search for arrays with same component type and suggest to convert them using Arrays.asList() call.

132.Pressing the same shortcut after you have invoked Smart-type Completion will search for chained expressions which have expected type.

133.When using Code Completion, you can accept the currently highlighted selection in the popup list with the Ctrl+Shift+Enter, IntelliJ IDEA will not just insert the selected string, but also will do its best to turn current code construct into syntactically correct one (balance parentheses, add missing braces and semicolons, etc.)

134.When using Code Completion in Java, you can accept the currently highlighted selection in the popup list with the exclamation sign (!) character. It will be inserted before the boolean method or variable you were completing, thus negating the whole expression.

135.To quickly complete a method call of a static method located anywhere in your project, libraries or JDK, enter a prefix and press Ctrl+空格 twice. You'll see all the matching methods. If you want the method you chose to be imported statically, press Alt+Enter and see what happens:

136.When you invoked Basic Completion (Ctrl+空格) in Java and didn't find your desired class in the list, it means that it's not yet imported in current file. Pressing Ctrl+空格 once more to view all accessible classes.

137.Pressing the same shortcut after you have invoked Smart-type Completion when an array type is expected will search for collections with same component type and suggest to convert them using toArray() call.

138.You can switch between sorting completion variants by relevance or alphabetically by using an icon at the bottom right:

139.Postfix code completion is applied "from right to left" and lets you avoid backward caret jumps when coding. After the code fragment that you want to change, type a dot (.), optionally press Ctrl+J and select the desired option.

140.Scratch files allow you experiment and prototype right in the editor, without creating any project files.To create a scratch file, press Ctrl+Alt+Shift+Insert, and then select its language.

141.If you've changed a live template, it becomes blue. If you want to return to the original text, right-click such a blue template, and choose Restore defaults on the context menu.Add several cursors to your editor. To do that, press Ctrl twice and hold the key, and then press the arrow keys.On Mac use Alt instead of Ctrl.

142.Clone the cursor strictly upwards or downwards. To do that, press Ctrl+Shift+A, type Clone caret, and then choose the desired action.

143.When choosing a live template from a suggestion list, press Ctrl+Q to view quick documentation - to be sure you make a right choice:

144.IntelliJ IDEA makes it possible to launch the embedded local terminal using keyboard only. Press Alt+F12, and see the terminal running.

145.Make your printouts (File | Print) nice and informative with the help of keywords.For example, use $DATE$ and $TIME$ to specify the exact date and time of the printout.

146.When in a Code Completion lookup, press Ctrl+Q to show documentation for a lookup item, including class constructors.So doing, if a class has more than one constructor, the links are shown:

Following a link shows documentation for the selected constructor.

147.Have you noticed the buttons    marking differences in the Differences viewer?You can simply apply differences between panes, by clicking one of these chevron buttons.Keep the Ctrl key pressed, and the chevron buttons change to   . Click one of these buttons to append contents of the current pane of the Differences viewer to the other pane.If you keep Shift pressed, the chevrons turn into  . Click this button to revert changes.

148.Hover your mouse pointer over a warning, error stripe or just some section of source code on the scroll bar outside of the scroll box, and you will see a lens:

If the lens annoys you, get rid of it by clearing the check box on the context menu of the code analysis marker:

149.To select multiple fragments in the "column mode", keep Control+Alt+Shift(on Windows and Linux) or Cmd+Alt+Shift(on MAC), and drag your mouse cursor:

150.You can easily select multiple fragments of text. To do that, it's enough to keep Alt+Shift and drag your mouse cursor:

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

152.You don't need to invoke quick documentation explicitly (Ctrl+Q) - if you just move your mouse pointer over the desired symbol, the quick documentation pop-up window will show automatically.To enable this feature, select the check box Show quick doc on mouse move in the editor settings.

153.To see all the available scratch files, choose Scratches view in the Project tool window.

154.Did you know that it's possible to copy rich text ?Make sure that the check box Copy rich text by default in the General page of the Editor settings/preferences is selected:

155.Did you know that you can remove just those tool window buttons you don't currently need?It's quite easy to do - just right-click the button you want to hide, and on the context menu choose Remove from Sidebar .

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

157.Ctrl+Y in the editor deletes the whole line at the caret.

158.Pressing Alt+/ helps complete words in the visible scope - so doing, the prototypes are highlighted.

Use Alt+Shift+/ to do same in reverse order.

159.Mind that you can move method parameters in both declaration and invocation. To do that, use Ctrl+Alt+Shift+向左箭头/Ctrl+Alt+Shift+向右箭头.Moreover, it's possible to propagate such a move in a method declaration to the method invocations - just immediately after move press Alt+Enter, and choose Apply signature change.

160.Use Analyze | Inspect Code to run code analysis for the whole project or a custom scope and examine the results in a friendly view.

161.A special variant of the Code Completion feature invoked by pressing Ctrl+空格 twice allows you to complete XML tag names from namespaces not declared in the current file. If the namespace is not declared yet the declaration is generated automatically.

162.Refer to a non-existing target tag in your Ant build file, and IntelliJ IDEA will suggest you to automatically create the corresponding tag. This intention action will not even make you change your current editing location.

163.You can inject SQL into a string literal (Alt+Enter | Inject language or reference | <SQL dialect>) and then use coding assistance for SQL.

164.Kotlin is a powerful, concise and expressive language crafted by JetBrains.IntelliJ IDEA supports it out-of-the-box.To create a Kotlin file, right-click the target folder, and choose the corresponding option on the New menu:

165.IntelliJ IDEA provides two Kotlin project types: Kotlin (JVM) and Kotlin (JavaScript):

166.IntelliJ IDEA allows you to easily call a Java code from Kotlin:

167.One can easily convert any Java class to the Kotlin one with the same semantics.To do that, just choose Code | Convert Java File to Kotlin File on the main menu:

猜你喜欢

转载自www.cnblogs.com/318west/p/9754728.html