Max Power
Max Power

Reputation: 841

WebStorm shortcut to comment a line

Is there a way in WebStorm to comment or uncomment a specific line or selected block of source code with shortcut?
I tried to use CTRL + / but it doesn't work for me.

Upvotes: 83

Views: 220607

Answers (16)

ToddEmon
ToddEmon

Reputation: 1350

I have an AZERTY keypad in French, so this was the answer for me :

Ctrl + Shift + / on the numpad

Because / out of the numpad was detected as :, even with Caps Lock on.

You can check how the keystrokes are actually detected by IntelliJ in :

On Windows : Settings > Keymap > click on the icon of Magnifying glass with cubes (tooltip is "Find Actions By Shortcut"). In the little tooltip that opens, you stroke the keys and observe the registered results.

On Ubuntu : Settings > Keymap > click on the icon of Keyboard, right next to the search input (tooltip is "Find Actions By Shortcut"). In the little tooltip that opens, you stroke the keys and observe the registered results.

Upvotes: 6

Balint G.
Balint G.

Reputation: 622

Use CTRL+/, but with the / located on the numpad.

Commenting with / (the one besides .) does not work for me, either).

Upvotes: 58

Hamid Abulqasemi
Hamid Abulqasemi

Reputation: 1

Use the English keyboard, the problem will be solved easily

Upvotes: -2

SpaceTrucker
SpaceTrucker

Reputation: 13546

On Windows with a German keyboard layout the default keyboard shortcut for the comment lines action Ctrl+/ conflicts with the bookmark shortcut Ctrl+7. You need to remove the keyboard shortcut for bookmarks in order to get this to work.

Upvotes: 10

Irrech
Irrech

Reputation: 1394

Try to use:
Ctrl+/ for Line Comment
or
Ctrl+Shift+/ for Block Comment
or
Set you own keyboard shortcut in Settings from File -> Settings... -> Keymap.
Then search for "comment".

Note: It's the numpad / that works.

References:
https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html

Upvotes: 104

Ghader
Ghader

Reputation: 11

control + / (this is the mathematical one which is located on the numbad)

Upvotes: 1

Juampi Martinez
Juampi Martinez

Reputation: 1

try ctrl + shift + 7 or num lock and then ctrl + /

Upvotes: 0

As said before on Mac Montery 12 on Idea 2020.3

CMD + NumPad /

or from Action dialog:

enter image description here

Upvotes: 1

Hamit YILDIRIM
Hamit YILDIRIM

Reputation: 4539

its possible to use inellij IDEA by the way you customized before with an IDE like VisualStudio Settings -> KeyMap -> Choose your old IDE its a grate! feature life saver :)

Upvotes: 0

glu
glu

Reputation: 99

It is necessary to switch to the English layout

Upvotes: 0

Kocher
Kocher

Reputation: 41

You need to activate this option:

  • 'Settings' > 'Keymap' > 'Use national layouts for shortcuts (requires restart)'

Screenshot

Upvotes: 4

Raimo Johanson
Raimo Johanson

Reputation: 256

Commenting out each line of selected code for Mac users without numpad would have to add a keyboard shortcut:

  1. Navigate to settings: Preferences > Keymap > Main menu > Code
  2. Double click on Comment with Line Comment
  3. Insert your shortcut, for example: cmd + shift + 7 would be interpreted as shift + cmd + 7 but works the same.

Upvotes: 3

pinaci
pinaci

Reputation: 353

If Ctrl + Shift + / doesn't work , try Ctrl + Shift + Num Pad /. You can check the exact configuration in settings->keymap.

Upvotes: 7

sleepy
sleepy

Reputation: 69

@Note Shortcut IntelliJ IDEA

  • Ctrl + / => comment or uncomment a line -> //
  • Ctrl + shift + / => comment or uncomment block of code -> /**/
  • Ctrl + y => delete a line
  • Ctrl + d => duplicate a line

Upvotes: 7

Vadiraj S J
Vadiraj S J

Reputation: 717

  1. Ctrl + / ==> To comment/uncomment a line .
  2. Ctrl + Shift + / ==> To comment/uncomment block of code.
  3. Ctrl + Y ==> To delete a line.

Upvotes: 9

Dirk Schumacher
Dirk Schumacher

Reputation: 1655

On a Mac with an extra keyboard it is CMD + Numpad's /.
The one on the native Macbook keyboard I did not get to work.
Check this post as well: Intellij comment shortcut opens help tab on the Mac menu bar

Upvotes: 9

Related Questions