Configure and use automatic indentation for a consistent coding style
Johannes Schmid
jhs@gnome.org
Jaume Planas
jplanas@itberga.com 2011
Gil Forcada
gilforcada@guifi.net 2013

# Auto-indentation

# Configuring and using auto-indentation

## Manual configuration

Automatic indentation is configured in the preferences (EditPreferences) in the tab corresponding to the used programming language. The indentation width for several types of statements can be set there.

The big disadvantage of manually configuring indentation is that all developers working on a project must use the same settings or it will result if different styles used in the same files. For a better solution, see the next section.

Unless explicitly changed in the preferences the indentation settings found in the Modeline of a file will be used instead of the configured settings to keep the file consistent.

## Modelines

Modelines are used to help editors to automatically detect the indentation mode which should be used for a particular file. They are especially useful if many developers work on the same project and use different environments.

Anjuta supports modelines in the two formats used by Vim and Emacs.

# Indenting blocks of code

Normally new lines are appropriately indented automatically but you can indent existing lines or all selected code with the EditAuto-Indent menu item.