Hey,
Format the code is really important for readability code. So, here is how to save and format the code with a macro.
- Edit -> Macros -> Start Macro Recording
- Press “CTRL+ALT+L” then “CTRL+S”
- Enter a name for your macro

- Go to Settings -> Keymap -> Macros
- Find your macro and add a keyboard shortcut for it. Mine is ⌘S. You can do which keys you want.

and finally: Ta-daaa :) Now, you can use your macro to save and format the code easily :)
If you have any question, ask me :)
Have fun!
Have fun!