Sam Lee
Sam Lee

Reputation: 10453

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

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 am editing Javascript if that makes a difference. Thanks.

Upvotes: 2

Views: 831

Answers (2)

Anand
Anand

Reputation: 3760

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

Upvotes: 0

doug
doug

Reputation: 70048

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.

Upvotes: 2

Related Questions