English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux indent command

Linux Command大全

The Linux indent command is used to adjust the format of C original code files.

The Linux indent command is used to adjust the format of C original code files.

Syntax

indent [parameters][source file] or indent [parameters][source file][-o Target file]

Parameters:

  • -bad or--blank-lines-after-declarations  Add a blank line before the declaration section.
  • -bap or--blank-lines-after-procedures  Add a blank line before the program.
  • -bbb or--blank-lines-after-block-comments  Add a blank line after the comment section.
  • -bc or--blank-lines-after-commas  If there is a comma in the declaration section, it will be on a new line.
  • -bl or--braces-after-if-line  The '{' after 'if(,' or 'else,' or 'for,' etc.) and the subsequent execution section are on different lines, and '}' is on a separate line.
  • -bli<缩排格数> or--brace-indent<缩排格数>  Set the indentation space for '{' and '}'.
  • -br or--braces-on-if-line  The '{' after 'if(,' or 'else,' or 'for,' etc.) and the subsequent execution section are on different lines, and '}' is on a separate line.
  • -bs or--blank-before-sizeof  Leave a space after 'sizeof'.
  • -c<栏数> or--comment-indentation<栏数>  Place the comments to the right of the code at the specified column.
  • -cd<栏数> or--declaration-comment-column<栏数>  Place the comments to the right of the declarations at the specified column.
  • -cdb or--comment-delimiters-on-blank-lines  The comment symbol is on a separate line.
  • -ce or--cuddle-else  Place 'else' after the '}' of the if execution section.
  • -ci<缩排格数> or--continuation-indentation<缩排格数>  Specify the indentation space after line breaks for long statements.
  • -cli<缩排格数> or--case-indentation-<缩排格数>  Set the indentation space when using 'case'.
  • -cp<栏数> or-else-endif-column<栏数>  Place the comments to the right of the 'else' and 'elseif' statements at the specified column.
  • -cs or--space-after-cast  Leave a space after 'cast'.
  • -d<缩排格数> or-line-comments-indentation<缩排格数>  Set the indentation space for comments that are not placed on the right side of the code.
  • -di<栏数> or--declaration-indentation<栏数>  Place the variables of the declaration section at the specified column.
  • -fc1or--format-first-column-comments  Set the format for comments placed at the beginning of each line.
  • -fca or--format-all-comments  Set the format of all comments.
  • -gnu or--gnu-style  Specify the use of GNU formatting, which is the default value.
  • -i<格数> or--indent-level<格数>  Set the number of spaces for indentation.
  • -ip<格数> or--parameter-indentation<格数>  Set the indentation number of the parameters.
  • -kr or--k-and-r-style  Specify the use of Kernighan & Ritchie's format.
  • -lp or--continue-at-parentheses  Align the content of each line within parentheses vertically when the description is too long and wrapped, and the description contains parentheses.
  • -nbad or--no-blank-lines-after-declarations  Do not add a blank line after the declaration block.
  • -nbap or--no-blank-lines-after-procedures  Do not add a blank line after the program.
  • -nbbb or--no-blank-lines-after-block-comments  Do not add a blank line after the comment block.
  • -nbc or--no-blank-lines-after-commas  Do not wrap lines in the declaration block even if there are commas.
  • -ncdb or--no-comment-delimiters-on-blank-lines  Do not make the comment symbol a line by itself.
  • -nce or--dont-cuddle-else  Do not place 'else' after '}'.
  • -ncs or--no-space-after-casts  Do not leave a space after 'cast'.
  • -nfc1or--dont-format-first-column-comments  Do not format comments placed at the beginning of each line.
  • -nfca or--dont-format-comments  Do not format any comments.
  • -nip or--no-parameter-indentation  Do not indent the parameters.
  • -nlp or--dont-line-up-parentheses  Do not align the starting column of each line within parentheses when the description is too long and wrapped, and the description contains parentheses.
  • -npcs or--no-space-after-function-call-names  Do not add a space after the function name in the call.
  • -npro or--ignore-profile  Do not read the configuration file .indent.pro for indent.
  • -npsl or--dont-break-procedure-type  Place the program type and program name on the same line.
  • -nsc or--dont-star-comments  Do not add an asterisk '(' to the left of the comment.*)。
  • -nsob or--leave-optional-semicolon  Do not process extra blank lines.
  • -nss or--dont-space-special-semicolon  If the 'for' or 'while' block has only one line, do not add a space before the semicolon.
  • -nv or--no-verbosity  Do not display detailed information.
  • -orig or--original  Use Berkeley's format.
  • -pcs or--space-after-procedure-calls  Add a space between the function name and '{' in the call.
  • -psl or--procnames-start-lines  Place the program type on the line before the program name.
  • -sc or--start-left-side-of-comments  Add an asterisk '(' to the left of each line comment.*)。
  • -sob or--swallow-optional-blank-lines  Delete extra blank lines.
  • -ss or--space-special-If there is a line in the 'for' or 'while' block, add a space before the semicolon.
  • -st or--standard-output  Display the results on the standard output device.
  • -T  Indent the name of the data type.
  • -ts<格数> or--tab-size<格数>  Set the length of tab.
  • -v or--verbose  Display detailed information during execution.
  • -version  Display version information.

Indent code formatting instructions

Indent parameter used Value Meaning
--blank-lines-after-declarations bad Add an empty line after variable declarations
--blank-lines-after-procedures bap Add an empty line after the function ends
--blank-lines-before-block-comments bbb Add an empty line before block comments
--break-before-boolean-operator bbo Long lines are broken before logical operators
--blank-lines-after-commas nbc In variable declarations, variables separated by commas do not break into lines
--braces-after-if-line bl "if" and "{" are split into two lines
--brace-indent 0 bli0 "{" does not continue to indent
--braces-after-struct-decl-line bls Define structures, "struct" and "{" are split into two lines
--comment-indentationn c33 Comments after statements start at line33
--declaration-comment-columnn cd33 Comments after variable declarations start at line33
--comment-delimiters-on-blank-lines ncdb Do not change single-line comments to block comments
--cuddle-do-while ncdw "do --- The "while" in "while" and the preceding "}" start on a new line
--cuddle-else nce "else" and the preceding "}" start on a new line
--case-indentation 0 cli0 0 spaces for case statements within switch
--else-endif-columnn cp33 Comments after #else, #endif start at line33
--space-after-cast cs Add a space after type conversion
--line-comments-indentation n d0 Single-line comments (do not indent from1Column starting), do not indent to the left
--break-function-decl-args nbfda Disable: One parameter per line for function arguments
--declaration-indentationn di2 Variable declaration, variable starts at2Line, that is, it is not necessary to align.
--format-first-column-comments nfc1 Do not format comments starting from the first line.
--format-all-comments nfca Do not enable the switch for full formatting of comments.
--honour-newlines hnl Prefer to break long lines at the position of newlines in the input.
--indent-leveln i4 Set the number of characters to indent, if it is a multiple of tab, use tab to indent, otherwise fill with spaces.
--parameter-indentationn ip5 Parameter description indentation in old-style function definitions5spaces
--line-length 75 l75 The longest non-comment line75
--continue-at-parentheses lp Continuation lines start from the parentheses on the previous line
--space-after-procedure-calls pcs Insert a space between the function and "("
--space-after-parentheses nprs Do not insert space between "(" and ")" after ")"
--procnames-start-lines psl Place the function name and return type on two lines in the definition
--space-after-for saf There is space after the word "for"
--space-after-if sai There is space after the word "if"
--space-after-while saw There is space after the word "while"
--start-left-side-of-comments nsc Do not add space in the generated block comments*
--swallow-optional-blank-lines nsob Do not remove the optional blank lines
--space-special-semicolon nss a for or while statement in a line, do not add space before ";"
--tab-size ts4 one tab is4an empty space(It should be divisible by")-in")
--use-tabs ut Use tab to indent

Linux Command大全