“Align Field in Columns” C/C++

耗尽温柔 提交于 2021-02-08 05:14:40

问题


Is there a way to configure Eclipse code formatter for C/C++ to Align fields in columns

//without formatting
int mRect = 0;
int mSquare = 0;
bool isTriangle = false;

//to look like this???
int  mRect      = 0;
int  mSquare    = 0;
bool isTriangle = false;

For Java I found this Eclipse: Auto-align "=" in assignments


回答1:


I tried with OCDFormat.jar as described at https://stackoverflow.com/a/18491579, and it works for C++ too.

It would be still nice if we can do this with native eclipse formatter.




回答2:


The Eclipse plugin columns4eclipse should do the trick (gratis, open source, I use it with Eclipse 4.3 x64 and 4.5 x64 on Windows 7). It is not language-dependent.

(OCDFormat is ok too though a bit less flexible and there is an issue with some (common) operators).



来源:https://stackoverflow.com/questions/30104147/align-field-in-columns-c-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!