22

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?

3 Answers 3

16

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.

4
  • 1
    This does not apply to the latest versions of Gedit with GNOME 3.
    – Flimm
    Commented May 30, 2019 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". Commented Aug 9, 2019 at 7:53
  • @RaoulSteffen I don't think there's a Tab Width setting though.
    – Flimm
    Commented Aug 9, 2019 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). Commented Aug 18, 2019 at 13:49
12

For GNOME 3, go here

GNOME 2

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)

1
  • This does not apply with the latest versions of Gedit in GNOME 3.
    – Flimm
    Commented May 30, 2019 at 13:21
9

Open Terminal and type:

gsettings set org.gnome.gedit.preferences.editor tabs-size 4
4
  • 1
    Thank you! This answer works in the latest version of Gedit in GNOME 3.
    – Flimm
    Commented May 30, 2019 at 13:22
  • 1
    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. Commented Dec 1, 2019 at 20:35
  • I found the insert-spaces with gsettings list-recursively org.gnome.gedit.preferences.editor | grep space. Commented Dec 1, 2019 at 20:48
  • For auto indentation: gsettings org.gnome.gedit.preferences.editor auto-indent true Commented Dec 1, 2019 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .