2

I am currently using gedit for two programming projects. One is done with Python, the other one with Java. In the Java project I have to use tabs and in the Python-one I have to use spaces.

Can I configure gedit in a way that I don't have to manually change the tab/space settings?

3
  • I had a similar question (fonts instead of tabs) and ended up writing my own plugin for that selection. See accepted answer to this question
    – xubuntix
    Nov 18, 2011 at 17:07
  • Thanks xubuntix. I've seen your answer, but it wasn't the same question. So I thought that changing another setting might be different. If it isn't I guess I'll start a little google code project which fulfils my demands with yours in one plugin. Nov 18, 2011 at 17:27
  • I know its not the same, just wanted to make sure you saw that one. Having all this in one plugin might even be better... Good luck.
    – xubuntix
    Nov 18, 2011 at 17:40

2 Answers 2

1

Not that I could see, I think you have to move up the IDE - editor to get to where you are wanting to go.

Geany might do this...

http://www.geany.org/Main/About

1

This can be done with the gedit plugin for modelines. Modelines are lines that you add to files for which you want certain settings. When you open files with modelines in editors that support them the editors will behave according to the modelines. So, you can think of modelines as per file settings of how for example indenting should work.

Here's how to do what you want in gedit:

  1. Make sure the plugin is loaded (Edit - Settings - Plugins - Modelines).
  2. Add modelines with the settings you want to your files.
  3. Gedit should act according to the modelines now.

Gedit support Emacs, Kate and Vim style modelines. Here's an example how you can do what you ask for with Emacs style modelines. Edit your java files such that they contain the following first line:

/* -*- mode: java; indent-tabs-mode: true; tab-width: 4 -*- */

class myfirstjavaprog
{  
        public static void main(String args[])
        {
           System.out.println("Hello World!");
        }
}

This modeline will make the files containing it indent with tabs and and a width equal to 4 spaces. For your python files you can use the following first line:

/* -*- mode: python; indent-tabs-mode: nil; tab-width: 4 -*- */

print "Hello, World!"

This modeline will make files containing it indent with 4 spaces.

Obviously you could do something similar with Kate and Vim style modelines.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .