I want to comment out a block of code in sublime text.
I see it in RailsCasts, but don't think he uses sublime text ... to do the following ...
if (uncommented) some uncommented example # if (commented) # some commented example code # end end
Is there a shortcut in sublime text that I can use to insert the block of #'s?
The shortcut to comment out or uncomment the selected text or current line: Windows: Ctrl + / Mac: Command ⌘ + / Linux: Ctrl + Shift + /
In the C/C++ editor, select multiple line(s) of code to comment out. To comment out multiple code lines right-click and select Source > Add Block Comment. ( CTRL+SHIFT+/ )
Ctrl + Shift + / (or Cmd + Shift + / if you're on a Mac). Right click in the current buffer and select HTML Nest Comments -> Comment/Uncomment Selection . Open an HTML file, pop out the console in Sublime Text from View -> Show Console, and type view.
Fortunately, if you use Visual Studio Code, commenting out a block of code is really quick and easy. All you need to do is select that code block with your mouse, then press the following key combination: Ctrl + K then press Ctrl + C if you're using Windows. Command + K then press Command + C if you're on a Mac.
The shortcut to comment out or uncomment the selected text or current line:
Alternatively, use the menu: Edit > Comment
For the block comment you may want to use:
You're looking for the toggle_comment
command. (Edit > Comment > Toggle Comment)
By default, this command is mapped to:
This command also takes a block
argument, which allows you to use block comments instead of single lines (e.g. /* ... */
as opposed to // ...
in JavaScript). By default, the following key combinations are mapped to toggle block comments:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With