Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use a shortcut to comment out code automatically in Textmate?

Is there a shortcut to highlight and comment code in textmate, rather than putting in the comments manually?

like image 959
cjm2671 Avatar asked Nov 24 '11 12:11

cjm2671


People also ask

How can I comment out code quickly?

PDT allows you to quickly and easily comment and uncomment code by selecting a line or a block of text and tagging it as a comment. Comments can be added to single lines of code (Ctrl + /) or blocks of code (Ctrl + Shift + /).

How do I create a shortcut to a comment in HTML?

Keyboard Shortcut for Adding HTML Comments The shortcut is Command / for Mac users or Control / for Windows and Linux users. To add a single-line comment, just hold down the combo of keys shown above inside the code editor. Then the whole line you're on will be commented out.

Is there a shortcut to remove comments from a code?

I think the shortcut in English keyboards is just CMD + / Select the code you want to comment out then press CMD + k then CMD + c. To remove the comment, press CMD + k then CMD + u. Try with Ctrl + Shift + A, it worked for me.

How to comment out a line in a text file?

Use the keys Ctrl K, C to comment out the line and Ctrl K, U to uncomment the line. Show activity on this post. From your screenshot it appears you have ReSharper installed.

How do I add comments to my code?

There are shortcuts you can use for adding comments – and you'll probably end up using them a lot. The shortcut is Command / for Mac users or Control / for Windows and Linux users. To add a single-line comment, just hold down the combo of keys shown above inside the code editor. Then the whole line you're on will be commented out.

How do I comment out a code in VSCode?

The keyboard shortcut to comment code in VSCode is CMD + Shift + 7 (in a Spanish keyboard) but it doesn't work in codesandbox.io. I think the shortcut in English keyboards is just CMD + / Select the code you want to comment out then press CMD + k then CMD + c. To remove the comment, press CMD + k then CMD + u.


3 Answers

If you have the Source bundle installed:

⌘/

Comment in TextMate

If you don't, go to TextMate > Preferences > Bundles and check Source.

like image 189
tamasgal Avatar answered Oct 10 '22 23:10

tamasgal


⌘/

comment/uncomment selection

like image 30
daniel Avatar answered Oct 10 '22 22:10

daniel


shift + ⌘ + 7 or instead 7 the key with the slash "/"

like image 38
rome3ro Avatar answered Oct 10 '22 23:10

rome3ro