Tuesday, May 11, 2010

Customize Xcode like MSVS

After month time coding in Xcode, I think I should spend some time to learn Xcode and configurations so that I will be familiar with Xcode short-cut keys. Furthermore, I'll be able to configure my Xcode like Microsoft Visual Studio since I have done more than ten years .Net programming; at least, find out similar ways I use VS.

Key Bindings

This blog provides very useful information about how to customize key bindings. The basic idea is to create a customized .dict file:

/Users/USERNAME/Library/KeyBindings/DefaultKeyBinding.dict

The content of this file is JSON like:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
{
"KEY1" = "ACTION1"; /* Bind KEY1 to ACTION1 */
"KEY2" = "ACTION2"; /* Bind KEY2 to ACTION2 */
...
}

The blog list all the modification keys and actions.

This blog has a MSVC key bindings. I gave it a try, but I think I still like to use Xcode default kyes. I like VS smart list or code completion by Control+Space the most. In Mac, I found out that the default Xcode key is "Control+,", F5 or Option+esc. Mac Developer Tips >> Xcode code completion has detail description about this my favorite feature and more.

In the Xcode preference->Key Bindings, a list of actions and keys are defined there. I think the above default keys may fill the blanks when I create a new one as its instructions.

Copy and Paste

The basic copy and paste in Mac is very similar to Windows. For example, Command+C, X, and V for copy, cut and paste, and +Z for undo. I think Control+Y is for redo, but Command+Shift+Z is for redo(I think it make sense in Mac).

In Windows, you can select a text and drag it anywhere, or hold Control key to make a copy. In Mac, the copy is by holding Option key.

Selection Indent

This tip explains how to do selection indent and un-indent. The keys are Command+] or [ for block indent or un-indent.

Block Comment/Un-comment

To comment or uncomment a block of codes, use key Command+/. Repeat to uncomment. This tip (one out of 10) is from the tip by John Muchow.

Refactor

VS provides great set of Rectoring tools, renaming variable is a great one. Xcode also provide this feature. Select a variable and press Shift+Comman+J, a dialog window is displayed. Rename is in a selection on the top left. This article has detail description and picture to show what Refactor is.

Overall, all above pretty much codes most part of features and functions I have used in VS. Xcode is a very competitive development tool for Mac and iPhone application development. I think with my continuing exploring and efforts, I'll be able to find out more powerful features to increase my productivity.

0 comments: