Everytime I open a file in gedit, I have to change again the tab with from 8 to 4, as I prefer it.

Is there any configuration file where I can make 4 the default tab width?


In gedit's menu, go to Edit -> Preferences. When the "gedit Preferences" window pops up, click on the "Editor" tab, and you'll be able to change the Tab Width setting.

| improve this answer | |
  • 1
    This does not apply to the latest versions of Gedit with GNOME 3. – Flimm May 30 '19 at 13:21
  • 1
    @Flimm: In Gedit in Gnome 3, you can find the preferences dialog by clicking on the top bar of the screen, next to "Activities". – Raoul Steffen Aug 9 '19 at 7:53
  • @RaoulSteffen I don't think there's a Tab Width setting though. – Flimm Aug 9 '19 at 9:25
  • @Flimm: There is for me. Menu > Preferences > Editor > Tab Stops > Tab width. Looks much like the screenshot jrg posted in his answer. I have got Gedit 3.28.1 (as it came with Ubuntu 18.04). – Raoul Steffen Aug 18 '19 at 13:49

For GNOME 3, go here


Go to Edit > Preferences in gedit. Then, switch to the Editor tab:

enter image description here

Edit those preferences to your hearts content.

(Please excuse the ugly GTK theme, the latest Oneiric updates broke my XFCE themes)

| improve this answer | |
  • This does not apply with the latest versions of Gedit in GNOME 3. – Flimm May 30 '19 at 13:21

Open Terminal and type:

gsettings set org.gnome.gedit.preferences.editor tabs-size 4
| improve this answer | |
  • 1
    Thank you! This answer works in the latest version of Gedit in GNOME 3. – Flimm May 30 '19 at 13:22
  • Also you need this if you want to edit Python scripts: gsettings set org.gnome.gedit.preferences.editor insert-spaces true It tells gedit to use spaces instead of tabs. – Valentin Stoykov Dec 1 '19 at 20:35
  • I found the insert-spaces with gsettings list-recursively org.gnome.gedit.preferences.editor | grep space. – Valentin Stoykov Dec 1 '19 at 20:48
  • For auto indentation: gsettings org.gnome.gedit.preferences.editor auto-indent true – Valentin Stoykov Dec 1 '19 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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