My first steps after IntelliJ IDEA CE installation
Along with the pandemic times, the dynamics of my life changed significantly. With more free time I can use some of it for professional development at home. Until now, my old and rarely turned on laptop was used for emails and surfing the Internet. I needed to upgrade my local environment to a minimalistic development setup, and hence this short story.
No update, no configuration import of the previous version, just a completely fresh installation from scratch, and then those basic steps to move forward.
I used the Windows operating system, but all the steps apply in the same way on Linux.
In order of appearance
- Must-have plugins with required configuration
- Passwords storage
- GitHub integration
- Bash as terminal emulator with tuned prompt
- No tabs in editor
- Editor font
- Code style (Java)
I recommend two ways of navigating to Plugins Management
- Through Search Everywhere — press Shift twice and type “plugins” (handier)
- Through Settings — press Ctrl+Alt+s and type “plugins”
* Downloads 10,4M
* Rating 4,0
* Colors ignored files
* Highlights file syntax
* Downloads 2,5M
* Rating 4,3
* Broad support for database development
* Free for personal and commercial usage
* Set keyboard shortcut for “DB Browser” tool window— Press Shift twice and type “Keymap”,
* In the search toolbox write “Database Browser”,
* Add suitable shortcut, I personally use Alt + 4, the first unassigned Alt-like.
* Downloads 1,2M
* Rating 4,9
* Shows Git status in Project tool window including branch name and commits
* Press Shift twice and type “GitToolBox Global”
* Select “Project View” tab
* Remove path part from the layout definition
I very often have multiple repositories added as project modules. In such a case, I get a clear view of which Git branch is currently checked out.
Lombok plugin (Java projects)
* Downloads 9M
* Rating 4,3
* Removes highlighted errors (Lombok generates classes at compilation)
* Makes regular actions like Find Usages or Source code navigation working
* Enable default annotation processing — Press Shift twice and type “Annotation Processors”
* Check “Enable annotation processing”
* Select “Obtains processors from project classpath”
Be default IntelliJ IDEA saves passwords for protected resources in the KeePass database file. I strongly recommend moving the file location out of the IDEA context. This way I can easily share and store the file on my cloud storage.
- Press Shift twice and type “Passwords”,
- Update the database file path.
- Easy repositories browsing and cloning,
- Fast, two-clicks PR creation.
To enable the above features there is a need to register the GitHub account.
- Press Shift twice and type “GitHub”,
- Click +,
- Specify URL and credentials — I prefer to use a personal access token. It is important to keep in mind that token must have the repo, the gist, and the read:org scopes enabled.
Bash as terminal emulator with tuned prompt
By default, the terminal emulator runs with the default system shell. On Windows, it is Command Shell. Because of that, there is a need to install a bash shell for Windows and then configure IntelliJ. I personally prefer using “Git for Windows“, but it can be any other executable, for instance, bash from Cygwin.
After bash install
- Press Ctr + Alt + s and type “terminal”,
- Select Tools -> Terminal,
- In application settings section specify “Shell path” and optionally “Tab name”,
- Optionally, one can consider disabling the IDE shortcuts overriding, which is what I personally do.
Last but not least, change the default “DOS-like” bash prompt format. In my opinion, the “MINGW” part and the new line at the end are completely unnecessary. This can be done either through the customization of the Git configuration shell scripts named git-prompt.sh or through the standard bash startup file.
- Press Alt + F12,
- Go to home directory — run `cd` command
- Create bash startup file with prompt format definition — run `echo ‘PS1=”\w\$ “‘ > .bashrc`
There is one very useful feature which can be easily included in prompt, a Git branch name. Because I usually use a terminal to invoke git commands, having branch info in the first plan is very handy. Below is an example
And here's the terminal window
No tabs in editor
Using multiple tabs in the editor, having many files open at once, reduces my comfort, and distracts me. I feel much more agile having one file open at a time and navigating effectively using handy keyboard shortcuts for navigation popups, like Recent Files (Ctrl + e), Recent Locations (Ctrl + Shift + e) or more generic Switcher (Ctrl + Tab).
- Press Shift twice and type “Configure Editor Tabs”,
- In the “Appearance” section, select “None” from the drop-down list.
Cosmetic but significant configuration of editor font type and size.
- Press Shift twice and type “Font”,
- Specify “Font” and “Size”.
Code style (Java)
No wildcard imports
According to SonarSource, wildcard imports are critical code smell, which should be avoided. Wildcards imports may cause namespaces conflicts, so instead, it's better to always import single classes.
- Press Ctr + Alt + s and type “Java”,
- Select Editor -> Code Style -> Java,
- Select Imports tab,
- Set a safely big number for “Class count to use import with *” and “Names count to use static import with *”
All the best, stay healthy and Godspeed!
All trademarks and registered trademarks used or referenced in this article are trademarks of their respective owners.