Saturday, June 22, 2013

[Xcode] Let's Customize Shortcut


If you are using eclipse (FDT, Flash Builder) before, you will feel like you can't breeze while coding via Xcode and will be surprise that poor Mac dude coding in pain and they just didn't realize that. For example  It can't even duplicated and delete line by single shortcut. And even worst someone make money from this issues so don't pretend this shit (and a lot more) not happend.

For example...


To delete line.

Xcode
Control-A to go to the beginning of the line, then Control-K to delete it, and another time Control-K to remove the empty line. 
Eclipse
Ctrl+D

To duplicate line.

Xcode
Control+A to go to the beginning of the line, Shift+Down Arrow to select it, Command+C to copy and Command+Y to paste twice
Eclipse
Ctrl+Alt+Up/Down

Bitch please! I did some complain about stupid Mac keyboard behaviour  here and guess what...it keep coming more and more! Arghhhh cut the crap! Let's mod it FTW.
  1. Open Finder -> Select Applications.
  2. RIght click at Xcode -> Show Packages Contents.
  3. Find your way to...
    /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
  4. Open File with some text editor e.g. Sublime
  5. Go to bottom of file then insert XML below as another element.
       <key>My Ass</key>  
       <dict>  
               <key>Delete Line</key>  
               <string>moveToEndOfLine:, deleteToBeginningOfLine:, deleteToEndOfParagraph:</string>  
               <key>Duplicate Line</key>  
            <string>selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:</string>  
       </dict>  
  6. Save it (But if you can't, try Googling for permission sudo vi)
  7. Open Xcode -> Preferences -> Key Bindings.
  8. Find "My Ass" group that should be appear at the bottom.
  9. Modify it as you like e.g. Ctrl+D for delete line and Ctrl+Shift+D for delete line.
  10. Use it and now you allow to breeze.
That's made my day, until we meet again :)
PS : I have to Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop...which is awkward moment too!

No comments: