I want to learn how can I automatically optimize imports after each save as we do Eclipse(save actions).
CTRL + ALT + O ---> to remove the unused imports in windows. However, you can also change the keymap of "Optimize Imports" in settings.
4 Answers. Show activity on this post. Disable File | Settings | Editor | General | Auto Import | Optimize imports on the fly. Normally you don't need to add imports manually, IDEA does it for you.
IntelliJ IDEA offers an option to Optimize imports on the fly in Settings
| Editor
| General
| Auto Import
and Optimize imports option in the Commit Project
dialog.
The mentioned answer works, but there is also the Intellij "save actions" plugin available from the JetBrains plugin repository that does that (as well as other things): Intellij Save Actions Plugin.
Installation
File > Settings > Plugins > Browse repositories... > Search 'Save Actions' > Category 'Code tools'
Disclaimer
I'm the plugin developer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With