Android studio:
CTRL + ALT + L (Win/ Linux)
OPTION + CMD + L (Mac)
Update for Ubuntu As Rohit faced the problem in Ubuntu to format code shortcut, because the
CTRL + ALT + L
key is used to lock the screen in Ubuntu.
I found that Ubuntu which handle the key event first. So try to change the
CTRL+ALT+L
action in Ubuntu just to be sure.
Steps are :-
Go to
System Tools -> System Settings -> Keyboard -> Shortcuts Tab -> System -> Lock Screen
Select the row
New Accelerator...
will be visible then press any Special key with Alpha key (like Shift + L). You changed the key shortcuts.
Now check format key in Studio.
Update came from Henry Chuang, and also in another answer given by user2340612.
You can also use eclipse sortcuts. Windows and Linux, go to
File > Settings > Keymap
, Mac OS X, go to > Preferences > Keymap
and choose eclipse from the dropdown menu.Netbeans:
I use NetBeans 7.1. Pressing Alt+Shift+F indents your selection. If nothing's selected, it indents the whole file.
In newer versions of NetBeans, 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 press Alt+Shift+F. NetBeans asks"Recursively format selected files and folders?" and pressing OK will recursively format all the selected files/folders.
On Mac OS X, shortcut is Ctrl+Shift+F. (note: it's Ctrl and not ⌘)
Eclipse:
Ctrl+Shift+F to invoke the Auto Formatter
Ctrl+I to indent the selected part (or all) of you code.
Use Cmd+A first if you wish to format all text.
The keyboard shortcut is Ctrl+I
The keyboard shortcut is Ctrl+I
I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
ReplyDeleteRegards,
Angular training in chennai
Thanks ROSHINI RS for reading this tutorial.
DeleteCheck eclipse shortcuts at Click Here
ReplyDelete