Gedit: tabs or spaces dependent on syntax

geditmake

I almost always use the Insert spaces instead of tabs feature in gedit. The one exception is when writing a Makefile which requires tabs. I don't suppose there is a way to make this option dependent on the syntax being used? I.e. automatically switch back to tabs when Makefile is detected.

Best Answer

There seems to be several ways to handle this.

Modelines

gedit has a modeline plugin. If you enable it you can use the Emacs modeline option Indent-tabs-mode (or any other supported modeline option with the same effect). By setting that option to true you can make gedit indent with tabs for the file in question. So, to enable tab indentation in a Makefile add the following line to it:

# -*- indent-tabs-mode:t; -*-

Makefiletab

There is a gedit plugin named Makefiletab which is said to "force the option spaces-instead-of-tabs off for all Makefiles." I do not know if it works though as I haven not tried it.

Related Question