开发者

In Textmate, how can I change the style of comment line?

开发者 https://www.devze.com 2022-12-20 17:37 出处:网络
When I select a line in Textmate and do the shortcut for comment line (command-L on Mac), it uses C-style comments (ie. /* ... */). How do I change it to use C++ style comments (ie. // ...). I a开发者

When I select a line in Textmate and do the shortcut for comment line (command-L on Mac), it uses C-style comments (ie. /* ... */). How do I change it to use C++ style comments (ie. // ...). I a开发者_高级运维m editing Javascript if that makes a difference. Thanks.


First, in an open TM window:

  • go to the control bar (at the very bottom)

  • click the icon with an upper-case "L" in a gray circle (the Language icon), then

  • select the language (javascript) from the pop-up that appears after you click (after you've done this, you should see javascript just to the left of the language icon)

  • cmd-/ (command + forward slash) will give you the language-appropriate comment symbol.


Under default bindings, Cmd-L brings up the Go to line popup in Textmate.

In Textmate 2 alpha (.9561), with Javascript or C, you can use:

1) Cmd-/ for line commenting (Bundles->Source->Comments->Comment Line):

  • current line

// cursor on this line

  • All selected lines

// all these

// lines were

// selected

  • commenting from selection to end of line

On this line, only the string of hashes // ###### was selected

2) Cmd-Opt-/ for block commenting selection (Bundles->Source->Comments->Insert Block Comment)

/* all

these

lines

were

selected */

0

精彩评论

暂无评论...
验证码 换一张
取 消