Is there a shortcut to make a block comment in Xcode?

前端 未结 16 1184
后悔当初
后悔当初 2020-11-30 18:57

I\'m writing ANSI-compatible C code, and hence I can\'t use the line (//) comment. I\'m using Xcode. In Sublime Text and Eclipse, and I think most other IDEs, t

16条回答
  •  春和景丽
    2020-11-30 19:23

    UPDATE: Xcode 8 Update

    Now with xcode 8 you can do:

    + + /

    Note: Below method will not work in xcode version => 8

    Very simple steps to add Block Comment functionality to any editor of mac OS X

    1. Open Automator
    2. Choose Services
    3. Search Run Shell Script and double click it

    Add the below applescript in textarea

    awk 'BEGIN{print "/*"}{print $0}END{print "*/"}'

    1. Save script as Block Comment

    Add a keyboard shortcut

    Open System Preference > Keyboard > Shortcuts, add new shortcut by clicking + and right the same name i.e. Block Comment as you given to applescript in the 4th step. Add your Keyboard Shortcut and click Add button.

    Now you should be able to use block comment in Xcode or any other editor, select some text, use your shortcut key to block comment any line of code or right click, the context menu, and the name you gave to this script should show near the bottom.

提交回复
热议问题