Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commenting out code blocks in Atom

Tags:

atom-editor

People also ask

How do I align code in atom?

atom-alignment packageUse ctrl+cmd+a on Mac or ctrl+alt+a to align multiple matches. If you want to align the first match only, call Atom Alignment:Align from the command palette.

How do you comment out code in Visual Studio code?

Comment Code Block Ctrl+K+C/Ctrl+K+U If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code.

What is the shortcut key for 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.


According to this, cmd + / should do it.

And for Windows and Linux, it is ctrl + /.


Atom does not have a specific comment-block function, but if you select more rows and then use the normal ctrl-/ (Windows or Linux) cmd-/ (Mac), it will comment all the lines.


Command + / or Ctrl + shift + 7 doesn't work for me (debian + colombian keyboard). In my case I changed the Atom keymap.cson file adding the following:

'.editor':
  'ctrl-7': 'editor:toggle-line-comments'

and now it works!


Also, there are packages:

  • Comment package for atom (https://atom.io/packages/comment)
  • Block-comment-lines https://atom.io/packages/block-comment-lines
  • Sublime Block Comments

Pressing (Cmd + /) will create a single line comment. i.e. // Single line comment

Type (/** and press the Tab key) to create a block comment ala

/** * Comment block */