6

Is there a way to indent the code in delphi? I have to work on a programm that has thousands of lines of code. In eclipse which i had worked before, i have used CTRL + SHIFT + F to format all code by formatting tabs/whitespaces and also divide code lines in a way that it is visible without horizontal scroll. Is there a way to do the same in delphi?

delsql
  • 601
  • 2
  • 7
  • 15

4 Answers4

6

There is a way to format the code in the whole unit with indentation.

Menu -> Edit -> Format Source

Menu -> Edit -> Format Source

You can also use Ctrl + K + I and Ctrl + K + U to indent current or selected lines.

kot-da-vinci
  • 1,152
  • 16
  • 30
2

I assume you are looking for a way to format the code in the whole unit with indentation.

This is not included in the regular IDE. But there is a code formatter contained in an 'experimental' version of the GExperts:

http://blog.dummzeuch.de/experimental-gexperts-version/

mjn
  • 36,362
  • 28
  • 176
  • 378
2

In addition to the code formatter in GExperts, which mjn already mentioned, there is also one in CnPack.

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
0
  1. Activate CnPack -> Editor Enhancements -> Tab/ShiftTab to indent/unindent
  2. Press Alt then use the mouse to select a block text you want to indent. Note: with Alt pressed you can select multiple lines of code starting at a random column (opposite of what would happen if you don't press Alt, when your selection will be applied of full rows).
  3. Press Tab to move/indent the selected block of text.

My life would be sad without Alt+Block select then Tab.

Gabriel
  • 20,797
  • 27
  • 159
  • 293