Keyboard shortcut for comment blocks /* ... */ in Xcode
comments, xcode
Solution
It isn't as good as I'd like it to be, but this is the best option I've come up with so far. I created a few custom code snippets in Xcode, each of which replaces a shortcut with an appropriately sized comment block.
For example, I have it replace the shortcut "com1" with an 80-character-wide comment block (for non-indented lines). That's the following code in the Snippet Library in Xcode:
/*******************************************************************************
<#comment#>
******************************************************************************/
For indented lines, I have shortcuts "com2", "com3", and "com4", which are 76, 72, and 68 characters wide (respectively).
======
Also, Xcode's documentation isn't that helpful when it comes to code snippets. To create a new code snippet, show the Utilities view (the pane on the right) and select the `{}` icon towards the bottom to show the Code Snippet Library. Select some code to add, and drag it over to the Code Snippet Library (by left-clicking and holding for a second and then dragging - as a Windows user it took me far too long to figure this out). This will create a new entry titled `My Code Snippet` at the very bottom of the Code Snippet Library, which you can mouse over and `Edit` to your liking.
======
EDIT: Here I have uploaded a zip file containing five code snippets. Levels 1 through 4 (com1, com2, com3, com4) are 80, 76, 72, and 68 characters wide, respectively. Level 0 is a single line comment block that does not automatically format width (I use it for single comments to maintain formatting).
EDIT 2: Also, user code snippets are stored in `~/Library/Developer/Xcode/UserData/CodeSnippets/`.
Problem
I am looking for a keyboard shortcut to comment out a selection of code. I already know about Command + / to add `//` in front of selected lines of code, but I want to be able to create `/* ... */` comment blocks this way. The reason I want a shortcut for `/* ... */` is to be able to fold the comment blocks, which as far as I know you cannot do with the `//` comments. So either I need a way to fold `//` type comments or a keyboard shortcut to create `/* ... */` comments any ideas?