Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:58:35+00:00 2026-06-18T10:58:35+00:00

I am looking for a keyboard shortcut to comment out a selection of code.

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:58:37+00:00Added an answer on June 18, 2026 at 10:58 am

    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/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to cancel keystrokes of keyboard shortcuts or command keys
I've been looking into low level keyboard hooks lately. I have already got mine
I'm looking for a code navigation addin for Visual Studio 2008: Press a keyboard
I'm looking to find out how to automatically set the keyboard focus to a
I'm looking for some function to determine opening and closing virtual keyboard on samsung
I am looking for a way to send and receive keyboard information regardless of
I am looking for a way to simulate mouse and keyboard input in C++.
A good example for what I'm looking for is the custom keyboard used by
Looking at some assembly code for x86_64 on my Mac, I see the following
I am looking for a keyboard short-cut to complete creating the default accessors for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.