42

I would like to centre my code in the Android Studio's/IntelliJ's editor, like as it is done in the Distraction Free Mode.

Right now, it is always aligned on the left side of the editor, but I want to have it in the centre of the window. I could not find any option for this in the settings. Is this possible without entering the Distraction Free Mode?

2 Answers 2

103

Add -Deditor.distraction.free.mode=true in Help | Edit Custom VM Options and restart the IDE. This will center the editor without the other features of the distraction free mode (like hidden tool windows).

11
  • Thank you so much!
    – Jitsusama
    Jul 26, 2018 at 12:27
  • 2
    A restart is needed.
    – gone
    Jan 14, 2019 at 14:25
  • one extra small thing, is that line numbers are aligned on the right side, it would be nice to have them right at the code side, do you know if it is possible?
    – mloureiro
    Nov 25, 2019 at 10:11
  • 1
    In my case, it doesn't work for Idea 2020.2. I've added that parameter, restarted but the text is still aligned to the left. Upd. I did exit distraction mode and then again enable distraction mode and it works! Thanks a lot!!
    – maks1m
    Sep 7, 2020 at 9:17
  • 1
    @mloureiro It is not possible according to this post
    – Vikto
    Mar 23, 2022 at 17:40
26

You can also activate this option through the registry:

  1. Type shift shift to search everywhere
  2. Type registry and select "Registry..."
  3. Type distraction to filter the list
  4. Check the box for "editor.distraction.free.mode"
  5. Close the registry

Voilà, no restart needed.

1
  • This is a better solution than the above, IMHO.
    – filipe
    Aug 30, 2022 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.