Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I autoindent in Netbeans?

In eclipse you can click Ctrl+I at any line, and it'll automatically indent the line or group of lines according to the indentation scheme you chose in the settings.

I'm really missing this feature in Netbeans. Is there any equivalent feature?

I'm aware of Alt+Shift+F but it's not good enough. I want to indent a group of lines, and not all the file.

like image 756
Elazar Leibovich Avatar asked Oct 08 '22 12:10

Elazar Leibovich


People also ask

How can I get beautify code in NetBeans?

If your file loses correct formatting, you can reformat the whole file by selecting Source | Reformat Code (Ctrl-Shift-F). If you have any lines selected, the reformatting applies only to those lines. If you have copied code, you can have it inserted with correct formatting by pasting with the Ctrl-Shift-V shortcut.

How do I Auto Import in NetBeans?

Use Ctrl + Shift + I will import all the required packages.


1 Answers

Shortcut:

  • Windows: Alt+Shift+F
  • Mac OS X: Ctrl+Shift+F (note: it's Ctrl and not )

On using above shortcut, NetBeans indents your selection. If nothing's selected, it indents the whole file.

You can even format multiple files/folders at a time! In the Projects window/sidebar, if you select one or more folders or files and use the shortcut, NetBeans asks "Recursively format selected files and folders?". Pressing OK will recursively format all the selected files/folders.

Above shortcuts works on NetBeans from versions 7 to 12.

like image 201
Manu Manjunath Avatar answered Oct 11 '22 01:10

Manu Manjunath