ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The first feature i mentioned is widely available.
The 2nd and 3rd features are also widely available while typing the code, but not for existing source files.
The first feature i mentioned is widely available.
The 2nd and 3rd features are also widely available while typing the code, but not for existing source files.
KDevelop automatically formats a source text in a predefined style. This style is highly configurable.
Note
The reformat source feature is currently available for C, C++, and Java™ only. Especially you cannot use it for scripting languages like e.g. PHP. This is because KDevelop uses the astyle application to implement this feature.
To set up a specific format style, select Settings->Configure KDevelop.. from the menubar. The Customize KDevelop dialog will pop up, where you have to select Source Formatter in the left hand tree. This will display a series of three settings dialog tabs to the right, namely a General Formatting Setup, a Indentation Style Setup, and a Other Formatting Setup.
Tip
Any style changes apply to newly entered text only. If you want to change the formatting style of an already existing source text you will have to explicitely use the Edit->Reformat Source command.
There's indent, astyle, bcpp perltidy, tidy, hindent, xmlindent. Depends on the code / document type you want to use it with, which you didn't mention by the way.
astyle and indent will probably do what you want then, else you might consider one of the formatters building into an IDE. For Java, you can use Eclipse for this. I think astyle does Java code too, although I've only ever used it for C & C++
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.