How to indent my code in codeblocks?

You (these are the default settings I believe) can select a block of code and press the Tab key. This will indent the entire block.

So for indenting a whole file: Ctrl + A, then Tab.

In addition, you can use Shift + Tab on a selected block to "unindent"

You can move through the open tabs with Ctrl + Shift + Tab.

As for the best shortcuts:

I like Ctrl + D to duplicate a line and

Ctrl + L to copy it.

Anyway, you can set whatever shortkeys you like in the Editor menu (there you will also be able to find all shortkey currently set).


[![][1]]2

Add shortcut as you wish from Settings->Editor->Keyboard shortcuts->plugins->Source code formatters(Astyle) or use Plugins->Source code formatters(Astyle)


CTRL+A to select the code and TAB for alignment.


Tips about tab identation are helpful when you write your code from begining. But if you paste code in CodeBlocks from some external source, like PDF document, that code often will not have good identation.

In this case, you need to select code, right click on it, and choose Format use AStyle option. This is a plugin for CodeBlocks for right text formatting.

I hope this will help someone!

Tags:

Codeblocks