One of the very useful features of IntelliJ is that when I am done editing a file, I can do a "optimize imports". this removes all the unused imports from my code.
This is very useful, but I have to do it for every file.
Can I do "optimize imports" for the entire project?
CTRL + ALT + O ---> to remove the unused imports in windows. However, you can also change the keymap of "Optimize Imports" in settings.
5 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.
Import settings from a ZIP archive Call File | Manage IDE Settings | Import Settings from the main menu. Select the ZIP archive that contains your settings in the dialog that opens. Select the settings you want to apply in the Select Components to Import dialog that opens and click OK.
Select the source root in the project tree;
1. Hit the keyboard shortcut for "Optimize import"
MAC
Cmd-shift-A
Windows
Ctrl-shift-A
2. You will see
3. Hit Run
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