# FAQ(26) - C or C++ indentation and effects; how can I turn off ?

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## QUESTION (26)

C or C++ indentation and effects; how can I turn off ?

## ANSWER

The C mode indentation is supposed to make editing 'C' easier, by forcing the user to follow a preset editing convection. The layout is pretty standard, following a 4 space indent, writing either K&R or standard 'Pascal' type layout, with braces aligning vertically.

The problem most new users have is the inability of the tab key to function, or more simply do not want to be 'forced' to write in a particular style (GNU writers will probably not like this either - conversely they will be using GNU emacs !!). However the constrained layout can be configured to create most styles and does help in a project situation, whereby most of the authored code roughly adheres to the same sort of layout conventions. For C++ users then edit "`hkcpp.emf`" rather than "`hkc.emf`".

## To turn off all automatic 'C' layout

To disable ALL automatic layout in C and C++ files then from the menu

    help -> Buffer Setup -> Setup Auto Indent

Or from the command line esc x buffer-setup and disable through the dialogue.

Restart the editor.

## To re-enable the <tab> key

To retain the 'C' layout aid, but re-enable the tab key operation then disable the Tab To Indent option in user-setup(3) i.e.

Tools -> User Setup -> General -> Tab To Indent

This enables the use of the TAB key in all column positions with the exception of column 0. A <tab> in Column 0 will still enable the automatic line re-formatting.

If you want real <Tabs> then disable the tab mode using user-setup(3) i.e.

Tools -> User Setup -> General -> Tab

## To change the 'C' Indentation Layout

The 'C' layout indentation is controlled from the indent(2) command (see `hkc.emf`), the indentation level is controlled by the variables $buffer-indent-width(5) and $buffer-indent(5) these may be changed in the Buffer Setup dialog.

[FAQ Index].

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>