IntelliJ IDEA functionality is vast. Therefore there are quite a few developers who make the most of it. However, everyone has their own set of favorite features and options. About a month ago, the Maxilect team massively shared their favorite IDEA practices in the internal chat meeting. Colleagues were very enthusiastic. We’ve planned one hour of discussion, but that was not enough for this topic. The meeting was repeated a week later.
We want to share the most exciting features (with links to the documentation, where everything is described in detail).
There were so many opportunities that I had to divide the article into two parts. Today we’ll talk about the screen setup and organizing the workspace. Also we’ll talk about multiple carets. Next time we will talk about workflow optimization.
Customizing the screen
IDEA allows flexible customization of the interface. However, it makes sense to spend time configuring the interface only if it is of fundamental importance. We’ve discussed such issues:
- adapting the display for a wide monitor;
- intolerance to tabs;
- maximum concentration on the code.
For those who use one wide monitor (instead of a pair of monitors), IDEA provides the Widescreen tool window layout setting (it can be easily found in Preferences -> Appearance & Behavior -> Appearance -> Widescreen tool window layout).
If you enable it, the bottom panel will be limited in width by the main screen. In this case, the side tools can be displayed vertically with the required number of columns.
An excellent example of how this works is in the official documentation.
IDEA allows you to change the default display of tabs. You can hide tabs in IDEA through Preferences -> Editor -> General -> Editor Tabs -> Tab placement -> None. Ctrl + E (or Command + E on Mac) will open the list of recently edited files to navigate files without tabs. There is also a hotkey to move back one File (Command + [).
There is an alternative way to hide the tabs from the top panel. Display the panel on any other side — on the left, right, or bottom, part of the form.
For those who need a more ascetic kind of interface, there is a zen mode. To switch to this mode, you need to select View -> Appearance -> Enter Zen Mode (instructions for switching to Zen Mode can be found in the documentation).
This mode removes unnecessary windows, leaving only the code on the screen so that there will be nothing to distract you. Unlike full-screen mode, the code appears in the middle, not on the side. This is convenient when using a widescreen monitor.
During debugging, when you need to jump between files, this mode is easily disabled.
Organizing All Projects in One Window
IntelliJ IDEA allows you to collect all active projects in one window (in one Projects list). To do this, you need to create an empty project in IDEA and import your work projects into it via Git -> Clone. IDEA will put everything into child folders by itself.
Not to produce new windows at the start of the project, you must interrupt the wizard and select File -> New module from the existing source. Then open build.gradle.kts in the project.
Projects will not get messed up. Each of them will have their branch, and they will be managed through the Git Branches menu.
If there are too many modules, their number can be changed in the Load / Unload Modules menu. Unload allows you to unload some root modules from a project temporarily.
IdeaVim is not an option of IDEA itself. It’s a third-party plugin. It adds hotkeys that make it easier to navigate the code. For example, you can move through 5 lines down or up, quickly search for the desired piece of text. IdeaVim has a separate buffer for saved text fragments, which is different from the OS buffer and many other valuable features.
The list of commands can be found in the plugin repository.
Integration with YouTrack
If the team uses YouTrack, IntelliJ IDEA can be integrated with this tool via a plugin that extends the functionality of the standard task manager.
The integration allows you to subscribe to changes in existing tickets and assign new ones. In this case, IDEA will show the updates in its notifications. If the work is constantly going on in IDEA, then it is more convenient than receiving the same notifications by email. Also, through the integration, you can pull up open tasks and create change lists and branches directly.
Integration is configured in File -> Preferences -> Tools -> Tasks -> Servers. In the YouTrack section, you can specify all the necessary data and rules for finding the necessary tickets. However, if the name of the ticket in YouTrack is in Russian, the Cyrillic name will be added to the project. In this case, the automatic substitution of the task name into the folder name can be disabled.
IDEA supports that kind of input. This thing is not new, but it turned out that not everyone uses it.
Multiple carets open up quite a lot of possibilities when working with large parameter lists. How to enable and use them is well described in the official documentation.
For example, from a list like this:
you can make this:
'aaa', 'bbb', 'ccc', 'ddd',
This works even if the elements of the list have different lengths. To do this, you can use the combination Ctrl + Shift + Right Arrow during selection. This combination selects a whole word with each cursor, regardless of its length. After that Ctrl + C copies all selected words to the clipboard. As a result, from this list:
Finally, we get the complete piece of code:
aaaaa = params ['aaaaa']bbbb = params ['bbbb']ccc = params ['ccc']dddddd = params ['dddddd']
Multiple cursors are very useful when there are hundreds of list items or even more — no need to waste time on monotonous repetition of the same operations.
That’s all for today. Next time, we’ll talk about which tools are convenient to use for managing commits and why it is easier for us to test and profile through IDEA.
The article was written based on the materials of the Maxilect internal meeting.