3

If I create a new Python file gedit uses Tabs as default for indentation.

I am sure I could find a way to configure gedit to change this to four spaces.

But I have a different goal.

I would like change this for all Ubuntu users for the future.

How to change this for all future Ubuntu users (world-wide)?

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
guettli
  • 1,777
  • If the question is who has the power to change this, then you should update the title of your question. Else, update the body of your question so the question matches that reflected in the title. – vanadium Mar 13 '21 at 13:34
  • @vanadium thank you for this hint, I updated the question. – guettli Mar 16 '21 at 08:12
  • can't you just do a pull request on github? – Irsu85 Mar 16 '21 at 08:32
  • 1
    @Irsu85 to which repo? I'd guess that's the crux of the problem. – muru Mar 16 '21 at 09:03
  • That said - I'm not even sure this will be possible - IIRC gedit doesn't do this per-filetype, so you'd have to change it for all filetypes, and that's just asking for flamewars. – muru Mar 16 '21 at 09:11
  • I really dont know, there are a lot of repos if i search ubuntu – Irsu85 Mar 16 '21 at 09:32
  • Maybe Ubuntu users are not using gedit for python editing and that's why others are not complaining? – jrw32982 Mar 18 '21 at 19:12

2 Answers2

4

EDIT

To make this the default for all future users in the world, you would need to go with a feature request, in one of several forms:

  1. Best option: a feature request for the individual application https://gitlab.gnome.org/GNOME/gedit/-/issues
  2. In Launchpad. Mark the bug with the tag [Wishlist] https://bugs.launchpad.net/ubuntu/+filebug
  3. Other options in Where can I send feature requests?

Then you would have to wait for it to be (1) accepted and (2) implemented... it is not up to you. You could contribute by developing the change (item 2 above). It may be not really hard.

Note: Given that the default behavior is often times a matter of taste (and I think this is one such case), you might likely have to settle for what was posted in the Original answer below.


Sources / related:

  1. https://wiki.gnome.org/Apps/Gedit/ReportingBugs
  2. https://www.reddit.com/r/Ubuntu/comments/3uo0u6/quick_question_how_do_you_submit_a_feature/

Original answer

gedit preferences, like other GNOME settings, are generally stored via the GSettings API, which is an implementation of the DConf specification. This stores the settings in a binary database.

The way to read from / write to this is via gsettings get / gsettings set, or dconf dump / dconf load. So for only the tabs-to-spaces you would use

$ gsettings set org.gnome.gedit.preferences.editor insert-spaces true
$ gsettings set org.gnome.gedit.preferences.editor tabs-size 4

For all gedit settings you could use

$ dconf dump /org/gnome/gedit/preferences/editor/ > gedit-settings.ini
$ dconf load /org/gnome/gedit/preferences/editor/ < gedit-settings.ini

(with a different user).


To make this the default for all future users in your system, you can set system-wide dconf settings by storing them in a text file under /etc/dconf/db/local.d and running dconf update. Only include here the settings you need.

As opposed to the EDITed part, you have control over this.


Sources / related:

  1. How to save GNOME settings in a file?
  2. https://help.gnome.org/admin/system-admin-guide/stable/dconf-custom-defaults.html.en
  3. https://unix.stackexchange.com/questions/289640/how-to-create-a-default-system-wide-dconf-setting-starting-from-just-created-ad
  4. https://unix.stackexchange.com/questions/8922/where-does-gsettings-store-its-files
  5. https://mail.gnome.org/archives/gedit-list/2015-November/msg00002.html
  6. Where are gedit's preferences?
4

Open an issue in the Gedit GitLab https://gitlab.gnome.org/GNOME/gedit, and then send a merge request with your proposed fix. If it is accepted, it would become the default behavior for all Gedit users (not just Ubuntu users, but also Fedora, Arch, and all other distros) worldwide.

However, whether the developers of Gedit would want to merge your patch is upto them. It is their software, and they decide the defaults.

Please understand that what you prefer, may not be preferred by everyone. Many people prefer tabs over spaces, and would not want to change gedit settings every time they do a new installation.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
  • I just want to change the default for Python files. All most all Python code uses four spaces for indentation. – guettli Mar 23 '21 at 15:28