Gedit uses TAB by default for Python: How to change this for all Ubuntu users?
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)?
Solution 1:
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:
- Best option: a feature request for the individual application https://gitlab.gnome.org/GNOME/gedit/-/issues
- In Launchpad. Mark the bug with the tag
[Wishlist]
https://bugs.launchpad.net/ubuntu/+filebug - 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:
- https://wiki.gnome.org/Apps/Gedit/ReportingBugs
- 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:
- How to save GNOME settings in a file?
- https://help.gnome.org/admin/system-admin-guide/stable/dconf-custom-defaults.html.en
- https://unix.stackexchange.com/questions/289640/how-to-create-a-default-system-wide-dconf-setting-starting-from-just-created-ad
- https://unix.stackexchange.com/questions/8922/where-does-gsettings-store-its-files
- https://mail.gnome.org/archives/gedit-list/2015-November/msg00002.html
- Where are gedit's preferences?
Solution 2:
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.