There is 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.
-
1In MAC `⌥⌘/` to comment only selected text within line, and repeat again for uncomment. – Kanagavelu Sugumar Aug 10 '21 at 08:20
-
I was trying to find how I could continue commenting on the next line, and the answer is `Ctrl+Shift+Enter` for those who ended up at this question from Google – Mattwmaster58 Oct 31 '21 at 08:48
16 Answers
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
-
2
-
1Thanks for showing how to change it in the Keymap settings. On thing bugs me: When I comment a line, the cursor jumps to the next line. Is there a way to let the cursor stay on the same line? – John Archer Jun 12 '20 at 08:39
Use CTRL+/, but with the / located on the numpad.
The question remains why commenting with / (the one besides .) does not work (it does not for me, either).

- 562
- 5
- 13
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

- 1,479
- 19
- 37
- Ctrl + / ==> To comment/uncomment a line .
- Ctrl + Shift + / ==> To comment/uncomment block of code.
- Ctrl + Y ==> To delete a line.

- 4,856
- 4
- 40
- 63

- 639
- 10
- 17
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.

- 13,377
- 6
- 60
- 99
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.

- 1,140
- 1
- 12
- 16
Commenting out each line of selected code for Mac users without numpad would have to add a keyboard shortcut:
- Navigate to settings: Preferences > Keymap > Main menu > Code
- Double click on
Comment with Line Comment
- Insert your shortcut, for example:
cmd + shift + 7
would be interpreted asshift + cmd + 7
but works the same.

- 246
- 2
- 6
You need to activate this option:
- 'Settings' > 'Keymap' > 'Use national layouts for shortcuts (requires restart)'

- 14,054
- 10
- 41
- 74

- 11
- 1
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 :)

- 4,224
- 1
- 32
- 35
try ctrl + shift + 7 or num lock and then ctrl + /
-
This answer does not contribute anything new to the topic. Please check the other answers to see if your answer offers any new information before posting – H3AR7B3A7 Jul 08 '22 at 20:07
Use the English keyboard, the problem will be solved easily
-
HI @Hamid Hamid Abulqasemi, your answer seems to be unclear. Please explain in little more detail. https://stackoverflow.com/help/how-to-answer – Mearaj Jun 20 '23 at 19:26