Code formatting tool in Linux: Indent

Source: Internet
Author: User

Code formatting tool in Linux: Indent

Under Ubuntu: $ sudo apt-Get install indent

Common settings:

Indent-NPRO-Kr-I4-ts4-sob-L80-SS-bl-Bli 0 file name

Parameter description:
-NPRO or -- ignore-profile do not read indent's configuration file. indent. Pro.
-Kr specifies the format of kernighan & Ritchie. It can be changed to-orig or BSD.
-I4 -- indent-level: set the number of cells to 4.
-Ts4: Set the tab Length
-Sob or -- swallow-optional-blank-lines Delete unnecessary blank lines.
-Line feed of L80 Code exceeding 80
-SS or -- space-special-semicolon if the for section contains only one line, add a space before the semicolon.
-NCs or -- no-space-after-casts should not be empty after cast.
-BL {branch display
-Bli 0 parentheses indent to 0

Note:

<1>-set both I4 and ts4

-I4: specifies the number of indentations. If it is an integer multiple of tabs, tab is used for indenting. Otherwise, spaces are used for filling.

-I4-ts4 cannot be indented by four spaces, but by a tab.

When you use Vim to view code,

Only set Ts = 4 in. vimrc

The code is Indented by four spaces.

<2> fileformats = UNIX, DoS

In Vim command mode, enter ": Set FFS" to obtain: fileformats = UNIX, DoS
Therefore, VIM supports both UNIX and DOS formats (different row Terminator)

Enter ": Set FF" to obtain the current file format.

If the format of the file to be converted is dos, there will be more ^ m after indent conversion.

Solution:

: Set FF = Unix

: WQ

$ Indent...

In this way, you can.
Refer:

Http://hi.baidu.com/houhou1999/blog/item/4983d41b680825c5ac6e75cd.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.