Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

There seems to be several ways to handle this.


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; -*-


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.

share|improve this answer
Thanks, I went for the modelines option. I had never heard of modelines before - looks very handy. – jsj Jan 28 '13 at 13:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.