A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
I use IntelliJ idea in fact not too long, after using this period of time, I think it is very useful. A lot of people who just turned from eclipse may not be able to get used to it, and I share some of the experience and common features in the process, and of course, before reading this, I recommend that you read IntelliJ idea's 20 auto-complete features, which describes the auto-complete features very well, Just the shortcut key Description section can also be more complete, can take care of the default binding keys inconsistent child shoes. This article in the description of the shortcut key is based on Mac OSX 10.5+ default Keymap, of course, will also provide relevant text description, if and my binding inconsistent can be directly to keymap search.Basic Settings Display Line numbers
This was a very simple question in eclipse, and some of the people who have moved to IntelliJ have asked this question. Set up in the same way later discovery only works on the current file, and opening another file still has no line number. It's like you're just executing commands in vim
set number , rather than setting the same effect in. vimrc. This needs to be set in the IDE settings, check it: Other settings can be selected by reference to this setting, such as displaying spaces and so on.
We often need to open a file when writing code, want to automatically open the file tree on the left link to the location, so it is convenient to find other files in this directory or other related files, in fact, this INTELLIJ provides several solutions, the first is the same way as Eclipse As follows:
AutoScroll to Sourceand
AutoScroll from source, IntelliJ is very user-friendly sub-two settings in the inside, you two are checked is the basic and Eclipse features maintained exactly the same, just tick a natural also can.
There is also a way to use the Navigation Barprovided by IntelliJ, IntelliJ many functions can be keyboard, this is like the keyboard operation of the necessary functions, the operation is to open the file, using the shortcut key alt +home , then there will be a drop-down, basically the file is located in the directory of the file list, you can use the upper and lower keys to choose other directories, is not cool?
?+UP (Jump to Navigation Bar)
Note: here is suggested to put
View > Navigation Bar the option point off, so that the use of shortcut keys will appear in your mouse position, the feeling will be more input, of course, you will basically lose the right to use the mouse, which requires you to use according to personal quirks.
If you are an Apple Computer user, it is recommended that you change to Mac OSX 10.5+ 's keyed bindings, because Mac OSX 10.5 is a Windows-compatible version of the keys are too lame, it is really uncomfortable, like your default
?+w is to turn off the label, In this key binding, it is a shortcut to select text based on a symbol.
Here are the main introduction of several may be commonly used, or you may not know IntelliJ in some of the shortcut keys, especially commonly used by you directly refer to the official website of the Keymap introduction getting started on it can be. Learn in the keymap of their own query needed shortcut key is the main, do not open the useless Baidu every time, the specific can refer to the link at the end of this article.Outline Pull Out
Before in eclipse a lot of a shortcut key is
ctrl+o , this can bring up all the member variables and methods of the code file, and can support the search is very convenient, IntelliJ this basic function is naturally, novice's words also often ask, this intellj in the shortcut key is
?+F12 (File Structure). If you are not a Mac OSX 10.5+ keying, the content in the parentheses is what you can search for in Keymap.
ctrl+alt+UpIntelliJ default is
?+D (Duplicate Line or Block)that there is a gap between this and eclipse, especially when there are multiple lines or when the content is selected, do not believe you can try. So you can put the definition of Keymap in
Duplicate Linesa shortcut key, I define that
Option+Dthis key in my default binding is not any shortcut keys, you can bind a try.
<name>SpringSource Milestones Proxy</name>you cursor in the milestones in a certain position, you want to replace the
SpringSource Milestones Proxyother words, false ideas replaced by
Test XX, In fact, you only need
Option+Up (Select Word at Caret)two to select the words you want, when you want in the development process, you will find that the keys used too much, more than the other without the keys of the editor or IDE, is not used to.
?+delete (Delete Line)or take advantage of IntelliJ intelligent function, cut the shortcut key, when the bank selects the text when the cut
`?+xwill follow the selected text to achieve the cut, but you do not have any selected text in the bank automatically cut the entire line, Then nature is like a shortcut key to delete the bank, but this is actually quite lame, recommended to use
智能自动完成 ctrl+shift+Space, When you have too many tips, this key will definitely surprise you.
ctrl+k, this is very useful, in the IntelliJ also does not lack this function, but in the Mac OSX 10.5+ 's keyed binding default is empty. It is said that Windows is bound in the default binding, you can query under, I myself bound one
?+ctrl+k (Find Word at Caret), no need to bind one myself, and then can be combined with other keys to
?+G (Find Next)achieve
?+Shift+G (Find Previous)the next function. It's very practical.
Our development is definitely version-controlled, when the previous eclipse when the local files and repository inconsistencies, then the file and the folder in which there will be a
〉 representation, it is easy to see the local files modified which some, but IntelliJ in the default is not the case. Just give changes to the file at the time of the change to provide color changes, not including its various parent folder Oh, if you want to like eclipse, you need to check the settings as well.
In fact, look at the English explanation can understand, this default after the opening if you want to adjust the display color of the folder when you go directly to
Settings > Editor > Colors & Fonts > File Status Adjust, you can adjust to the way you like.
IntelliJ in the resource file this personal feel is also a victory over eclipse, in the resource bundle mode to modify a property is quite convenient, you can modify the properties of all languages in an interface, all of this is done automatically, as shown in:
And it's nice to have a sort and grouping feature, especially this sort.
The default setting also has a problem, that is, Chinese default will be displayed as Unicode code, in fact, check a setting (
Settings > File Encodings ) can be, such as:
This way, all Unicode displays will automatically be converted to the language they should display.How a Web project that conforms to the MAVEN contract structure works better
Remember when you first started using Eclipse, the default is not to support the Java EE project, you must use a MyEclipse plug-in, until today as if someone is using this thing, when the time of each Web project modification must deploy, modify the things will be executed, It's very painful. Later on their own use of the Tomcat plug-in, this can ensure that you modify the JSP and static files do not need to deploy directly can be executed, because the Tomcat directory pointing in fact directly to your project files, so it is really worry a lot.
In IntelliJ If you are the traditional Java EE structure (the root directory has src,webmoudle such a structure), then add a tomcat directly in the run configurations, click the + sign to add ( Of course you need to be aware that although there is no search box, you can automatically filter the results by typing characters so that when you run the Java file, you need to make project active
?+F9 (Make Project) . But if you are in a project structure that conforms to the MAVEN agreement, it is not ideal to continue with this configuration. It is also necessary to make project to modify the JSP file every time, because IntelliJ will automatically give you a deployment after each make project, which seems to be back to the troublesome environment a few years ago.
This problem is easy to solve, just do not use this way to run your Web project, since the MAVEN structure of the project is naturally using MAVEN or gradle This build tool, then you need to use MAVEN jetty plug-in to run the project, such as configuration:
Of course, you can also automatically add one if you click to run it directly:
How eclipse Web Fabric projects are imported and run
See actually also did not have to use jetty, with TOMCAT6 or TOMCAT7 plug-in operation also can.
Given that some users have not yet transformed Maven to build the project, of course, I would like to say a heartfelt word, Build this piece or make a quick turn. Because not to turn the words also come out of this chapter alone, and some operations are still quite troublesome, the following will also talk about, or one by one way to come, when the import has two choices then I divided into two parts description, click
File > Import Project… , then select your project directory, click OK, such as:
The first type shown in this way, the import is basically the next to complete, but you can also pay attention to the first time to do something, for example, to help you analyze what the jar, if you use spring also to analyze all your configuration files. After the final completion of the project began to build the index, and so everything is ready we can complete the basic configuration, because the Web project is basically able to run on the Tomcat and other servers on the basic count of success. Several main points:
File > Project Structure , we mainly use several red parts in this section:
Let's look at these main components first:
We need to do the configuration mainly in the modules, the other several of their own according to the understanding configuration can be.
After these steps we can click
Run > Edit Configurations , click on the + sign in the upper left corner, then select **tomcat > Local Server * *, these steps are similar to eclipse, select the appropriate path and so on, only need to pay attention to, is to add a deployment, such as:
if the + sign in the deployment in the graph of Windows is probably on the right , clicking on it will pop up the dialog box and select the default Webmoudle folder for Eclipse (MyEclipse is the Webroot folder). This must not choose the wrong, do not choose the main folder of the project, otherwise the operation will not succeed, and then
ctrl+R run. Running in debug mode is
The basic reference is similar to the previous one, that is, the step is less than the previous step, if there is a problem refer to the previous section.HQL Query Support
Before Eclipse has a HQL plug-in can directly enter the HQL syntax, query test results are correct, in IntelliJ you can, but do not need any plug-in default support, if you import the project without automatically add hibernate support, That need to add hibernate support, mouse selected items, right click like:
Click to select Hibernate, if not hibernate should be the project has automatically added hibernate support. Then you can do it as follows:
Select the above hql icon, in the console input you want to enter the HQL can be, as the automatic completion of OH.
?+s(this key is saved all by default), so you need to be careful not to accidentally change a file, and then directly close the label, in fact, your unintentional operation has resulted in the modification of the file, May cause you to find a very strange error while the project is running, I have not found that I can turn off AutoSave settings, and if you are not obsessive about it, vim plugin may help you.
File, there is a strange power save mode, which is also illustrated here, as the name implies the power-saving model. When you tick this mode, IntelliJ will not give you to complete any auto-completion functions, such as the original you entered a character will automatically prompt, tick out later, if there is no, if this problem can be considered if you have the hand of the button oh, this is more suitable for the meeting when bored to see the code, It also saves power and does not affect the code you see.
F2allows you to see the Java file definition, you may need to configure this value in spring's configuration file, but this is not required in IntelliJ, because support for spring is perfect, You only need to type the name of class in the class's attribute and then
ctrl+空格 (Basic 这个在code的completion下面)complete the path automatically, and in the smart condition you may not need a crappy implementation.
?+sbut the problem is that no matter what file will execute the macro, not just the Java file, I am using this macro mainly to complete the tab to a space.
?+shift+up/down (Stretch to Top / Bottom), of course, other project views and so on can also use this shortcut to configure the next left and RIGHT ARROW keys to configure the use, convenient, highly recommended use.
For the first time, if there is any problem welcome message exchange, the original document on GitHub, if you have some skills may be together to improve this document. Just need to Fock then pull request on it, if you feel that a github account is too troublesome, then I personally think you are more appropriate to change careers. If you do not want to update just want to subscribe to the continuously updated content, only need to watch the item. You can also get to Project star so you can quickly find this item on your account page.
A little experience from eclipse to IntelliJ idea
Start building with 50+ products and up to 12 months usage for Elastic Compute Service