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:
- Make sure the plugin is loaded (Edit - Settings - Plugins - Modelines).
- Add modelines with the settings you want to your files.
- 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.