Commenting out code blocks in Atom

I have been moving from Webstorm and RubyMine to Atom and I really miss a feature from the Jetbrains editors where you select a code block and press CMD + - and it adds language specific comment character(s) to the beginning of each line. (# for ruby. // for js, /* for css etc.).

Is there a built in shortcut for Atom or a package which provides this feature?


Solution 1:

According to this, cmd + / should do it.

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

Solution 2:

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.

Solution 3:

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!

Solution 4:

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

Solution 5:

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 */