A collection of shortcuts for Android Studio and IntelliJ IDEA.
We have carefully selected 10 pieces.
- It's easy to remember because there aren't too many
- We have covered the most important ones. I am confident
I love shortcuts, and when I switch editors, I just start looking at shortcuts.
When I teach people shortcuts, I just over-teach them.
Even so, this time we made a careful selection.
I feel that I have collected good shortcuts that are reasonably priced and of high quality.
You can change the key of the shortcut, so write down the recommended key settings.
It is advantageous to change the ones that are used frequently.
You can change the settings from Keymap on the settings screen.
My environment is Linux (Fedora).
Shortcut collection
Search Everywhere (search all classes, files, etc.)
You can search for classes, files, etc. from the whole.
Windows/Linux |
Mac |
Press Shift twice |
Press Shift twice |
- Recommended key settings: OK by default. Easy enough to use
Call Hierarchy
You can hierarchically list the callers, such as where a method is called, where its caller is called, and so on.
It's easy to look at each one when there are many callers, and it's useful because you won't overlook it.
Windows/Linux |
Mac |
Control + Alt + H |
Control + Option + H |
- Recommended key settings: Control + H. H is an acronym for Hierarchy
- This is easier because there are fewer keys to press than the default
Find Usages
You can find out where variables, classes, and methods are used, by looking for references to variables, or looking for extensions to a class.
Variables display the location where the variable is being read and the location where it is being written.
So it's useful for finding things like "Where is this variable rewritten?"
Windows/Linux |
Mac |
Alt + F7 |
Option + F7 |
- Recommended key settings: Control + U. U is an acronym for Usages
- It is easier to push and remember than the default.
File Structure (displays the structure of the file)
You can see a list of variables and methods in the open file.
What's more, you can search the list and jump to the location where variables and methods are defined.
Windows/Linux |
Mac |
Control + F12 |
Command + F12 |
- Recommended key settings: Control + M. M is an acronym for Member
- It is derived from being able to search for members such as variables and methods.
Find in Path
You can search the contents of all files.
Windows/Linux |
Mac |
Control + Shift + F |
Command + Shift + F |
- Recommended key settings: OK by default. I think it's easy to remember if you think of the version with a wide search range of Control + F (search in file).
Delete Line
You can delete one line.
Windows/Linux |
Mac |
Control + Y |
Command + Backspace |
- Recommended key settings: Control + D. D is an acronym for Delete
- I want to operate it with one hand, and since it is used frequently, I think it is easier to combine it with a key near Control.
Extend Selection, Shrink Selection (Increase selection, reduce selection)
Each time you do this, the selection will scale.
For example, if you execute it several times with the cursor on the variable,
- Select the entire variable
- Select the left side of "="
- Select one line
- Select the entire method
The selection range gradually expands.
|
Windows/Linux |
Mac |
Expand selection |
Control + W |
Option + Up |
Shrink selection |
Control + Shift + W |
Option + Down |
- Recommended key settings: Shift + Alt + Up, Shift + Alt + Down
- Since it is unified to use Shift and cursor keys when selecting text normally, it is intuitive to operate. Of course, the behavior is different from the normal selection, so I added Alt.
Extract Variable
Extracts things around the cursor as variables.
The following two are common uses.
- Write and execute only the right side of
=
. It automatically fills the left side of =
- Execute where the method is called consecutively with
foo (). bar ()
. It splits this part into two lines, one that gets the return value by foo ()
and the other that calls the return value bar ()
.
Especially the first one is very frequently used.
You don't have to write the left side of =
yourself, which simply greatly reduces the amount of typing.
Windows/Linux |
Mac |
Control + Alt + V |
Command + Option + V |
- Recommended key settings: OK by default. V is an acronym for Variable
- Control + V is easier, but since it is used for "pasting", Control + Alt + V
Rename
Rename variables, class names, file names, method names, etc.
Windows/Linux |
Mac |
Shift + F6 |
Shift + F6 |
- Recommended key settings: Control + Alt + R. R is an acronym for Rename
- It's hard to remember if it's the default
- Same as Extract Variable, it's a refactoring companion, so it's Control + Alt + R in a shape that matches that (Control + Alt + V).
Next Highlited Error, Previous Highlited Error
You can jump to the next or previous error.
You can save yourself the trouble of searching with the mouse.
|
Windows/Linux |
Mac |
Next error |
F2 |
F2 |
Previous error |
Shift + F2 |
Shift + F2 |
- Recommended key settings: OK by default. In a shell script, the standard error output is "2", so I think F2 is easy to remember because you can associate it with it.
Unfortunately not selected
I was at a loss until the very end, but I was not selected.
The shortcut is Windows / Linux.
- Alt + Enter:
- Various things such as automatically fixing errors
- Not selected because everyone already knows
- Find Action(Control + Shift + A):
- You can search for actions. For example, you can find Usages by searching for "usage".
- It's convenient, but I chose it because it will be faster in the end to remember each shortcut without depending on this shortcut.
- Refactor This(Control + Shit + Alt + T):
- Display a refactoring menu such as Rename and Extract Variable. Even infrequently used ones such as Change Signature are displayed in the menu, so it is easy to use.
- Not selected for the same reason as the one above Find Action
- Quick Documentation(Control + Q):
- Display Javadoc. Now you can see Javadoc without mouse operation ...
- However, if Javadoc is set to appear instantly, it can be displayed reasonably quickly even with mouse operation, so I excluded it because there is a promising alternative.
- Parameter Info(Control + P):
- Shows what parameters the method takes. Unlike Quick Documentation, the arguments of other overloaded methods can also be listed.
- Sometimes very useful. This is because other shortcuts can only see information about the method they are actually calling, but this shortcut can call and see information about the arguments of the ** "not" ** overloaded method. To call and check the arguments of the ** "not" ** method, it takes tens of seconds to look at the Javadoc of developer.android.com in the browser, but only to check the arguments. You can use this shortcut to check it in an instant.
- I chose it because it is used less frequently.
Others-It's subtle but convenient to call it a shortcut
Really convenient guy
Digression
When different people talk about shortcuts
Occasionally, "mouse operation" vs. "keyboard shortcut", which is faster?
I sometimes talk about it in a binary opposition.
However, in reality, I feel that it is faster to perform both "mouse operation" and "keyboard shortcut" at the same time.
I think it's easy to understand for those who draw pictures and those who play games,
It's the same as those people operating a mouse or pen tablet with their dominant hand and a keyboard with their other hand.
Therefore, it is convenient to arrange the shortcuts so that you can operate the keyboard and mouse at the same time, basically with one hand.