Last active
August 29, 2015 14:04
-
-
Save baylej/0f96b694b6e178d0673f to your computer and use it in GitHub Desktop.
My indent command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# I do not recommend `indent` as a beautifier, because it will eat every | |
# space you manually add to align declarations. | |
indent -nbad -nbap -nbc -br -brf -brs -ncdb -cdw -ce -ci4 -cli4 \ | |
-d0 -di1 -nfca -i4 -il0 -lp -npcs -nprs -psl -sai \ | |
-saf -saw -ncs -nsc -npsl -nsob -ss -ts4 -ut -l0 $@ | |
# -nbad Do not force blank lines after declarations. | |
# -nbap Do not force blank lines after procedure bodies. | |
# -nbc Do not force newlines after commas in declarations. | |
# -br Put braces on line with if, else if, else, do, while, for. | |
# -brf Put braces on function definition line. | |
# -brs Put braces on structure definition line. | |
# -ncdb Do not put comment delimiters on blank lines. | |
# -cdw Cuddle while and preceding ‘}’. | |
# -ce Cuddle else and preceding ‘}’. | |
# -ci4 Continuation indent of 4 spaces. | |
# -d0 Set indentation of comments not to the right of code to 0 spaces. | |
# -di1 Put variables in column 1. | |
# -nfca Disable all formatting of comments. | |
# -i4 Set indentation level to 4 spaces. | |
# -il0 Set offset for labels to column 0. | |
# -lp Line up continued lines at parentheses. | |
# -npcs No space between the name of the procedure being called and the ‘(’. | |
# -nprs No space after every ’(’ and before every ’)’. | |
# -psl Put the type of a procedure on the line before its name. | |
# -sai Space after if. | |
# -saf Space after for. | |
# -saw Space after while | |
# -ncs Do not put a space after cast operators. | |
# -nsc Do not put the ‘*’ character at the left of comments. | |
# -npsl Put the type of a procedure on the same line as its name. | |
# -nsob Do not swallow optional blank lines. | |
# -ss On one-line for and while statements, force a blank before the semicolon. | |
# -ts4 Set tab-size to 4 spaces. | |
# -ut Use tabs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment