Astyle Formatting Plugins

Source: Internet
Author: User

can be integrated into visual Studio, Eclipse, and source insight. The following only describes the integration into the source insight
Download Address: http://sourceforge.net/projects/astyle/files/

1. Add a custom command

Click "Add" to start a name. "Run" command to add the command format, the first is the AStyle.exe path, followed by parameters

2. Add a custom menu

On the left, select the command you just added, right "menu" select "View", click "Insert"

3. Add a custom shortcut key

On the left, select the command you just added, click "Assign new Key" on the right and set the shortcut.

4. Astyle Common Parameters -p: Insert spaces on both sides of the operator, such as =, +,-et-P: Insert spaces around the brackets. Also,-D is inserted only outside the brackets, and-D only inserts the-u: Remove unnecessary spaces on both sides of the brackets

5. For example
Description Document: http://astyle.sourceforge.net/astyle.html

File Type

--mode
--mode=c
--mode=cs
--mode=java

Bracket method

--style=ansi
--style=kr 
--style=linux 
--style=gnu
--style=java

Tab Options

--indent=spaces=#/-s#
--indent=tab=#/-t#
--indent=force-tab=#/-t#

Add curly braces ' if ', ' for ', ' while ', etc.

--add-brackets/-j 
--remove-brackets/-XJ

*, &, or ^ near way

--align-pointer=type/-k1
--align-pointer=middle/-K2

Operator Add space

--pad-oper/P

Add space after keyword

Add empty lines before and after ' if ', ' for ', ' while ', etc.

--break-blocks/F

Delete empty lines

--delete-empty-lines/-xe

Remove extra spaces on both sides of parentheses

Line end with what file format

--lineend=windows/-Z1
--lineend=linux/-z2
--lineend=macold/-z3

Switch case is also indented as standard

--indent-switches/S

If it is a comment, it is also indented

--indent-col1-comments/Y

How the multiline conditional statement is indented, =0 represents and (alignment, =1 represents indentation once, =2 represents indentation two times, =3 indents a half

--min-conditional-indent=0/-m#

Convert tab to corresponding number of spaces

--convert-tabs/C

Sum up one,%f represents the current file

run> astyle--style=ansi--indent=spaces=3--add-brackets--align-pointer=name-- Pad-oper--break-blocks--unpad-paren--lineend=linux--indent-switches--min-conditional-indent=0%f run> Astyle-- Style=ansi-s3-j-k3-p-f-u-z2-s-m0%f 

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.