One of the small joys of being a professional of a trade, yes software engineering is a trade, is developing/learning a set of tools and tricks that speed up your job and improve efficiency. One such tool is keymaps in your favorite IDE. My IDE of choice is JetBrains IntelliJ and the following are 5 of my favorite keymaps or shortcuts in the JetBrains suite of products.
Rename Refactor (Shift + F6)
The rename refactor action is very handy when you want to rename a file, variable, or method. InteilliJ will highlight the target and allow you to type a new name. This name will be updated everywhere it appears in the scope. For the case of a file, class, or method the entire project will be searched and the new name will be applied. The action will apply to wherever you have your cursor or whatever you have highlighted.
Reformat Code (Cmd + Alt + L)
The reformat code action will reformat the entire file or a highlighted portion. The code will reformat to the standards set in the Preferences > Editor > Code Style > Java.
Optimize Imports (Ctrl + Alt + O)
The Optimize Imports action will delete unused imports, reorganize the imports, and combine or separate imports based on the configurations found in Preferences > Editor > Code Style > Java > Imports.
Collapse and Expand (Cmd + +/-)
This action will collapse and expand code in the editor window. Code folding points are automatically created based on scopes (i.e. class, method, logic branch). However, custom code folding can be configured using the <editor-fold> </editor-fold> tag. See our post on Custom Code Folds. When collapsing code use the minus and the plus when expanding code. If you want to expand or collapse all the elements in the file add shift to the button combination Cmd + Shift + +/-.
Toggle Case (Cmd + Shift + U)
The toggle case action is by far my favorite action. This action is particularly useful when working with static variables and enumerations. Applying this action will toggle all the selected characters to be capitalized or lowercased.
It should be noted that JetBrains IntelliJ is a highly configurable IDE and depending on the version or how the keymaps are configured the aforementioned keymaps may not be the same as what you have configured. You can go to Preferences > Keymap to search or remap action and keymaps. The dropdown at the top contains a list of canned keymaps that you may be more used to than the default.
The last resource I can recommend when looking up the keymaps for an action is Find Action (Cmd + Shift + A). This can also be found under the help toolbar option.
JetBrains IntelliJ, as will all of JetBrains products, offers a lot of useful functionality. Being able to easily access them helps us become more efficient as well as impress our colleagues. I hope these 5 keymaps help you or at least inspire you to look into the wide array of actions that JetBrains has available in their IDEs.