Xcode: indent code in one shortcut

I am using Xcode 7.3 with Swift 2.2.

The bottom line is that I'm pretty much tired of running:

Cmd + a
Ctrl + I

to separate all the code.

So, I think I pretty close found the solution by creating my own shortcut on IDETextKeyBindingSet.plist .

<key>My Custom Shortcuts</key> <dict> <key>Indent Code In One Hit</key> <string>selectAll:, ....., moveLeft:</string> </dict> 

I did a lot of tests, replacing "....." with different commands (combining this ), but I can not find a solution yet.

Any help is appreciated!

+5
source share
3 answers

Finally, I found the solution myself, without installing any unverified plugins.
I think these may be other solutions with higher performance.

  • Close Xcode
  • Change IDETextKeyBindingSet

     sudo nano /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist 

    Adding this:

     <key>My Custom Shortcuts</key> <dict> <key>Custom - Indent Code In One Hit</key> <string>selectAll:, cut:, paste:</string> </dict> 
  • Open Xcode, Cmd +; to open settings
  • Keyword and Filter Using Custom
  • Assign your favorite key binding.

enter image description here

  1. Exit the settings, put your code, try a new shortcut and feel the power!
+1
source

I think you should try this . It helps you re-read the code every time you Cmd + S

+1
source

"Command +]" will retreat all selected code.

0
source

All Articles