Skip to content

Instantly share code, notes, and snippets.

@pstef
Last active December 14, 2015 10:29
Show Gist options
  • Save pstef/5072515 to your computer and use it in GitHub Desktop.
Save pstef/5072515 to your computer and use it in GitHub Desktop.
GNU indent: what exactly -gnu is
-gnu - Use GNU coding style. This is the default.
----------------------------------------------------------------------------------------------
-nbad - Do not force blank lines after declarations.
-bap - Force blank lines after procedure bodies.
-nbc - Do not force newlines after commas in declarations.
-bbo - Prefer to break long lines before boolean operators.
-bl - Put braces on line after if, etc.
-bli2 - Indent braces 2 spaces.
-bls - Put braces on the line after struct declaration lines.
-ncdb - Do not put comment delimiters on blank lines.
-nce - Do not cuddle } and else.
-cp1 - Put comments to the right of #else and #endif statements in column 1.
-cs - Put a space after a cast operator.
-di2 - Put variables in column 2.
-ndj - Comments after declarations are treated the same as comments after other statements.
-nfc1 - Do not format comments in the first column as normal.
-nfca - Do not format any comments.
-hnl - Prefer to break long lines at the position of newlines in the input.
-i2 - Set indentation level to 2 spaces.
-ip5 - Indent parameter types in old-style function definitions by 5 spaces.
-lp - Line up continued lines at parentheses.
-pcs - Insert a space between the name of the procedure being called and the ‘(’.
-nprs - Do not put a space after every ’(’ and before every ’)’.
-psl - Put the type of a procedure on the line before its name.
-saf - Put a space after each for.
-sai - Put a space after each if.
-saw - Put a space after each while.
-nsc - Do not put the ‘*’ character at the left of comments.
-nsob - Do not swallow optional blank lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment