The config files use JSON-syntax, so these curly braces have to be placed comma-separated in the square-brackets that are there by default. If you don't have any other key-bindings already, then your whole Keybindings → User file would look like this, of course:

Oops! It shows that I am on a Mac. Maybe the windows_key + tab?
– gdelfinoJun 14 '12 at 17:08

3

@NunoGonçalves the menu does not show the new shortcut but it should work. make sure your Preferences - Keybindings-User contains exactly those lines and save that file. Also make sure ST knows which kind of filetype/syntax it should use (is your syntax highlighting correct?). If it still does not work try a different key (e.g. "f8" seems unused) then if that does not work either check whether user defined keybindings are disabled on your installation for some reason.
– Bernd ElkemannDec 13 '12 at 14:03

2

Having done nothing, it suddenly started working. :) I guess the problem was between the keyboard and the chair all along :) Thank you anyway. :)
– Nuno GonçalvesDec 13 '12 at 14:27

For those interested it is easy to change but for a lover of Netbeans and the auto-format you can change the key binding from F12 to ctrl+shift+F to use your beloved key binding. Sad part is that you have to select all to format the entire file. Netbeans still has the upper hand on that. If anyone knows how to overcome that limitation I'm all ears. Otherwise happy reindenting (auto-formating).

Not sure if anyone still looking at this but to respond to @jeff. Use , "args": {"single_line": false} after adding the command and then you dont need to select lines to format it. It format the entire document for you. (Nick has put in the fool command)
– Mr HMar 16 '13 at 12:53

NetBeans shortcut is Alt+Shift+F (by default; Ctrl+Shift+F opens Project Search), and is limited and not necessarily sensible (CSS doesn't work, and it may keep new code lines on the same line). Eclipse's shortcut is Ctrl+Shift+F, and it's better in some ways, and works on CSS, but still has an issue with new code lines. Both of them have some issues with new lines for inner-line attributes (like in HTML), though you can configure somewhat (more in Eclipse).
– DavicusOct 18 '14 at 17:57

cmd+a on mac or ctrl+a on windows will automatically select all the text for you in the current window. so do that, and then whatever key binding you chose for auto indenting to reformat the whole file.
– user137717Apr 29 '16 at 18:08