Whether you prefer indenting code with tabs or spaces, the last thing you want to do is mix both styles in one file. The gedit text editor lets you specify what to insert when you press tab, but if you’re jumping between files in different languages or written by different people, you must remember to check the settings each time you open a file.
gedit-autotab is a plugin for gedit that solves this problem by automatically changing the indentation settings to match the style detected in each file. The plugin works with gedit 2 (Ubuntu 11.04), and there’s a forked version available for gedit 3 (Ubuntu 11.10).
For gedit 2 / Ubuntu 11.04: Download this archive
and open it. Put the
autotab.gedit-plugin files in
~/.gnome2/gedit/plugins (create the
plugins folder if it doesn’t exist).
For gedit 3 / Ubuntu 11.10: Download the archive file from this
page and open it. Put
autotab.plugin files in
gedit/plugins folder if it doesn’t exist).
Edit->Preferences->Plugins, and select
Auto Tab to activate
the plugin. You will get a new item on the status bar showing the current
indentation style, which will change depending on the files you open.