Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to auto-indent a c/c++ code with Kdevelop?

Tags:

kdevelop

I've a source code that's not mine, there are not comment and it's completely not indented. Is it a really mess. Do you know if there is some option, addon for kdevelop that would auto-indent it?

like image 265
manty Avatar asked May 05 '11 18:05

manty


Video Answer


2 Answers

Assuming you're using KDevelop 4 and not the (no longer supported) KDevelop 3...

You can use "Edit > Reformat Source" to format the current file source.

You can also right click on one or more files in Projects view on the left and select "Format Files"

You can configure your source formatting settings in "Settings > Configure KDevelop > Source Formatter".

KDevelop 4 uses AStyle to handle the formatting.

Edit: It should be noted that there are also some settings in "Settings > Configure Editor" which configures the embedded KatePart.
These are the "as you edit" settings with no effect on the source formatting component detailed above. This would control the auto-indentation when inserting newlines after a bracket, for example.

like image 134
OliJG Avatar answered Sep 24 '22 06:09

OliJG


Good old command line indent : http://linux.die.net/man/1/indent

like image 29
Joel Falcou Avatar answered Sep 20 '22 06:09

Joel Falcou