Commenting out blocks of code in Atom

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

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

+122
atom editor
Jul 12 '15 at 4:35
source share
13 answers

Accordingly , cmd + / should do this.

And for Windows and Linux it is ctrl + / .

+249
Jul 12 '15 at 5:05
source share

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

+25
Feb 25 '16 at 13:26
source share

Command + / or Ctrl + shift + 7 does not work for me (debian + colombian keyboard). In my case, I modified the Atom keymap.cson file by adding the following:

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

and now it works!

+12
Jan 19 '17 at 20:19
source share

In addition, there are packages:

+11
Dec 18 '15 at 16:37
source share

Pressing (Cmd + /) will create a one-line comment. those. //Single line comment

Type ( /** and press Tab) to create an ala block comment

/** * Comment block */

+9
Feb 01 '18 at 15:57
source share

You can use Ctrl + / . This works for me.

+7
Aug 18 '16 at 12:24
source share

with all due respect to the comments above, there is no need to use the package:

 1) click on Atom 1.2) then ATL => the menu bar appear 1.3) File > Settings => settings appear 1.4) Keybindings > Search keybinding input => fill "comment" 1.5) you will see : 

keybindings panel in atom editor

if you want to change the configuration you just need to specify your keyboard layout file

+7
Mar 01 '18 at 20:37
source share

You can make a multi-line comment by selecting lines and pressing Ctrl + /. and now you can have many comment plugins

1) comment - https://atom.io/packages/comment
2) block-comment-lines - https://atom.io/packages/block-comment-lines

better one block comment, try this ..

+5
Jul 15 '16 at 10:35
source share

Modify your keymap.cson file and add

Window

 '.platform-win32 .editor':
   'ctrl- /': 'editor: toggle-line-comments'

Mac

 '.platform-darwin .editor':
   'cmd- /': 'editor: toggle-line-comments'

Now just select the text you want to comment and click on the keyboard.

+3
Aug 07 '16 at 23:20
source share

You can use Ctrl + Shift + / for Windows.

+3
Dec 07 '16 at 13:16
source share

Atom has no default block comments, so I would recommend looking for packages with atoms using β€œblock comments” and setting the one that suits you.

I prefer https://atom.io/packages/block-comment, because it has the closest key combination for commenting a line, and it works as I need, which means that it will not comment on the entire line, but only selected text.

line comment: CTRL+/block comment: CTRL+SHIFT+/ (with the plugin installed)

+1
Feb 20 '18 at 9:02
source share

On a Belgian keyboard declared by mac command + shift + / is a keystroke to comment out a block.

0
Dec 24 '16 at 17:18
source share

CTRL + / on windows, there is no need to select the whole line, just use the key combination in the line that you want to comment on.

0
Apr 14 '17 at 8:48
source share



All Articles