+102
Completed

Toggle comments

Jonathan Markevich 10 years ago updated by Alexander Blach (Developer) 10 months ago 6

There should be a simple way to comment out lines & blocks of code on all platforms.

Answer

Answer
Completed

Textastic 4.1 for Mac adds the new keyboard shortcuts “Toggle Comment” (Cmd-/) and “Toggle Block Comment” (Cmd-Option-/).

I haven't ever had this feature in a text editor. What a great idea!

+3

fwiw, I think the most common keyboard shortcut for this is CMD+/ 

Answer
Completed

Textastic 4.1 for Mac adds the new keyboard shortcuts “Toggle Comment” (Cmd-/) and “Toggle Block Comment” (Cmd-Option-/).

Is there a way to define the comment being toggled? I created a syntax for Hugo templating and when I am editing html template files with my custom Hugo syntax it would be very helpful were I able to define the comment snippet somewhere such that it knew to use `{{/*` cursor `*/}}` rather than `<!--` cursor `-->`

+1

This is defined in a .tmPreferences file, typically called "Comments.tmPreferences".

You need to define the TM_COMMENT_START and TM_COMMENT_END shell variables.

Please have a look at https://sublime-text-unofficial-documentation.readthedocs.io/en/latest/reference/comments.html - this web page also contains an example at the end of the page.