Quick Reference
Use your cursor to select multiple lines, then:
- Windows/Linux: ctrl + /
- Mac: command ⌘ + /
Detailed Guide
Single Line Comments
- Place cursor on the line
- Hit ctrl + / (Windows/Linux) or command ⌘ + / (Mac)
- Repeat to uncomment
// This line is commented
This line is not
Block Comments
Useful for documenting functions or temporarily disabling code blocks:
- Select multiple lines
- Hit shift + alt + a (Windows/Linux) or shift ⇧ + option ⌥ + a (Mac)
/* This entire block
is commented out
using block comments */
Alternative Methods
Line Comments (Windows Only)
- Comment: ctrl + k, ctrl + c
- Uncomment: ctrl + k, ctrl + u
Custom Shortcuts
- Open Command Palette (command ⌘/ctrl + shift ⇧/shift + p)
- Type "Keyboard Shortcuts"
- Search for "comment"
- Click the shortcut you want to modify
Pro Tips
- Line comments vary by language:
- JavaScript/TypeScript:
//
- Python:
#
- HTML:
<!--
- CSS:
/*
Code Formatting
Bonus shortcut for clean code:
- Windows: shift + alt + f
- Mac: shift ⇧ + option ⌥ + f
- Linux: shift + alt + f
Need a blog platform? Check out Hexo+Vercel .