JavaRush /Java Blog /Random EN /idea hot keys

idea hot keys

Published in the Random EN group
Usually in such posts people take documentation from JetBrains and simply dump out all the hotkey combinations indiscriminately. Yes, I also kept such pages in bookmarks, and yes, I also never opened them again. But we will go our own way. Idea hot keys - 1I will only tell you about what I use myself, I will tell you how they help. Some are banal, perhaps you already know all this, then just like it =) I will start with the hotkey combinations that I need most and go to the most banal, but used by me.

Let's go:

Alt + F8 - evaluate expression window. A very useful thing, as soon as I found out about it, I always used it. Now at work, at the next table, on the monitor, there is a sticker that says “Alt+F8”. In this window you can do whatever you want. For example, if you have a problem area in the code and 10 options on how to solve it. Instead of running the code 10 times, get to it in debug, open the evaluate expression window and run through all the PROFIT options.
Idea hot keys - 2
Ctrl + P - shows you a list of parameters accepted by the method. When I first learned about this combination, I was very happy because... I had to rewrite the method call to see the list of parameters. Also, if you know all the parameters and there are many of them, does this window constantly pop up and get in the way? Ctrl+P will remove it =)
Idea hot keys - 3
Ctrl + Q - will show the documentation for the method in a nested window, so as not to go to the source code. It helps to read about the accepted parameters and the return value.
Idea hot keys - 4
In the same step, Ctrl + B - go to the source code of the class\method or go to the variable declaration. Alt + F7 - will show where the variable/method is used, an alternative to Ctrl+F. I rarely use it, but now I remember.
Idea hot keys - 5
Shift + Shift (Double Shift, quickly press shift 2 times in a row) - search for everything, everywhere (searches for classes and files but not methods). When you remember that you saw something somewhere and even remember a couple of letters from the name. This window will search for you. When searching for classes, you can specify part of the name or only the first 2 letters. For example, BuRe will find BufferedReader.
Idea hot keys - 6
Ctrl + Shift + T – create a test class. If a build system is used, it will create the class according to the builder rules. If not used, it will be created nearby.
Idea hot keys - 7
Ctrl + Shift + V – smart paste, remembers the last few elements copied.
Idea hot keys - 8
Ctrl + Shift + Space – a smart summary that offers you options for substituting values ​​taking into account the context. No matter how smart I am, I seem to understand the context quite well myself, but sometimes it helps.
Idea hot keys - 9
Ctrl + Shift + A – search for an action. If you suddenly forget the hot keys for an action, but remember its name, you can find it. You can find any action and run it, for example, debug.
Idea hot keys - 10
The original hotkey combinations are over, now the banal ones will go (and without pictures): Ctrl + Alt + V – if you have written something and need to put it in a variable, press these keys and the idea itself will display the type + set the standard name. It helps a lot when you are confused and don't know what type of variable you need. It also works if you add “.var” to the end of the expression and press Tab or Enter
new String[10].var
after pressing Tab it will be:
String[] strings = new String[10];
Ctrl + Alt + M – will move the selected piece of code into a separate method; the hot key for refactoring is very useful. Alt + Enter – simple to solve any problems. In fact, it almost always helps. If there is any compilation error, if I don't know the exact solution, the first thing I do is look to see what the idea comes up with. Alt + Insert – auto-generation of anything and everything, methods, constructors, classes... (there will be a picture here, it’s below)
Idea hot keys - 11
Ctrl + O – overriding parent methods Ctrl + K – when working with git – commit Ctrl + Shift + K – when working with git – push Ctrl + Alt + S – IDEA settings Ctrl + Alt + Shit + S – project settings At this point, perhaps that's all. I don't think that the mouse is evil and that a real coder only uses the keyboard. Yes, perhaps this is sometimes convenient. But often you have to go into the browser, look for something and return. If you need to make minor changes or just look at something, you are too lazy to reach for the keyboard if the mouse is already in your hand. But the ones I wrote replace a long sequence of actions with one click. By the way, there is a plugin for this idea that will help you master hotkeys. Every time you use the mouse, it will show an annoying message. It will tell you what hotkey combination you should have used and how many times you used the mouse. I got tired of it after a week =) The plugin is called Key Promoter X, you can find it in the idea settings (do you remember how to get there?). Video from JetBrains where I first learned about some combinations. I've watched it several times, you can't take it all away at once. And yes, the last combination that was useful to me once. Ctrl + Shift + U - change the case of a word. For example, if the variable is now a constant, do not rewrite the name, but use Ctrl + Shift + U