SourceInsight code formatting plugin

Powerful IDEs such as VScode and eclipse have a one-click code formatting function. This function can be realized through a plug-in in SourceInsight. This plug-in is called AStyle. Next, take SourceInsight 3.5 as an example to explain how to install Astyle.

Open SourceInsight, click Options--Custom Commands, click Add, enter Astyle_C in the Command field, and enter D:\02_Data\AStyle\bin\AStyle.exe in the Run field --style=ansi -s4 -S -N -L- m0 -M40 --pad-oper --suffix=none --convert-tabs %f, as shown in the figure below. Among them, D:\02_Data\AStyle\bin\AStyle.exe is the path of AStyle, which needs to be modified according to the actual storage location. The "ansi" in the command means using ANSI C format. If you are developing Linux, you can fill in linux; if you are developing Java, you can fill in java here.

Add Astyle plugin

Then we can assign a shortcut key to AStyle, and press this shortcut key to format the code in one click! Set shortcut key operation: click Options-Key Assignments in turn, then enter Astyle in Command to find the Astyle_C we just set, click Assign New Key to assign a shortcut key to it, and click OK to confirm. For example, the following figure assigns a shortcut key, Ctrl+Alt+C. It should be noted that the plug-in cannot be undone after formatting, so be careful before formatting.

Set shortcut keys

Astyle plug-in download address: https://pan.baidu.com/s/1wBv5x4j12T-xiZx4Vw3bKg Extraction code: s6xy 

Guess you like

Origin blog.csdn.net/qq_27575841/article/details/115019345