ajsie
ajsie

Reputation: 79686

php: auto indent the whole code?

isnt there any software/plugin to netbeans/eclipse that auto indent the whole code after i've inserted it?

not just indent when i press ENTER for new function.

i want to paste in a code for example without indents and it will auto indent everything automatically since it can recognize what language is used.

should save a lot of time.

Upvotes: 10

Views: 14887

Answers (5)

John Zammit
John Zammit

Reputation: 11

In Netbeans go to the Source menu, choose the Format option. It does what you need. It will follow the formatting options you set from Tools menu, Options dialog.

Upvotes: 1

Gordon
Gordon

Reputation: 316969

In Zend Studio (and I guess in Eclipse with PDT as well), you can right click your pasted document in the editor view and select Source Format. Rules for source formatting are edited in Windows Preferences PHP Code Style Formatter. You can select Code Conventions like PEAR or ZF there by default or invent your own.

If you just want to indent some selected lines of code back and forth you select it and hit tab (or shift tab to unindent). This will not resolve any nested code though. Use Ctrl Shift F for that (thanks to Paul Lammertsma for pointing that out).

Upvotes: 13

6bytes
6bytes

Reputation: 6132

In Eclipse you can press Ctrl+Shift+f to autoindent your open file.

Upvotes: 11

Rich Adams
Rich Adams

Reputation: 26574

I believe the Eclipse shortcut to auto-indent the selected code is Ctrl+i, at least it is in Eclipse for Java, so I assume it would be the same for Eclipse PHP.

Upvotes: 0

Pekka
Pekka

Reputation: 449425

Polystyle is a standalone tool that can be integrated into most IDEs, and does highly configurable source code formatting for many languages. It costs $15.

Upvotes: 0

Related Questions