Settings | Editor | General > Other | Strip trailing spaces on Save -> None.
Updated for IntelliJ Idea 2021+
Settings | Editor | General > On Save | Remove trailing spaces on: <…> -> None.
Settings | Editor | General > Other | Strip trailing spaces on Save -> None.
Updated for IntelliJ Idea 2021+
Settings | Editor | General > On Save | Remove trailing spaces on: <…> -> None.