IntelliJ shortcut to comment line

Intellij Idea

Intellij Idea Problem Overview


There is a way in webstorm to comment or uncomment a specific line or selected block of source code with shortcut? I try to use CTRL + / but doesn't work for me

Intellij Idea Solutions


Solution 1 - Intellij Idea

References

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

Try to use Ctrl+Slash or Ctrl+Shift+Slash for block comment

If this doesn't work show in your Setting -> Keymap -> Search comment

Solution 2 - Intellij Idea

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).

Solution 3 - Intellij Idea

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

Solution 4 - Intellij Idea

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: https://stackoverflow.com/questions/38144396/intellij-comment-shortcut-opens-help-tab-on-the-mac-menu-bar

Solution 5 - Intellij Idea

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

Solution 6 - Intellij Idea

@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

Solution 7 - Intellij Idea

On Windows with a German keyboard layoout 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.

Solution 8 - Intellij Idea

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.

Solution 9 - Intellij Idea

As said before on Mac Montery 12 on Idea 2020.3

CMD + NumPad /

or from Action dialog:

enter image description here

Solution 10 - Intellij Idea

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.

Solution 11 - Intellij Idea

You need to activate this option:

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

Screenshot

Solution 12 - Intellij Idea

It is necessary to switch to the English layout

Solution 13 - Intellij Idea

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMax PowerView Question on Stackoverflow
Solution 1 - Intellij IdeaIrrechView Answer on Stackoverflow
Solution 2 - Intellij IdeaBalint G.View Answer on Stackoverflow
Solution 3 - Intellij IdeaVadiraj S JView Answer on Stackoverflow
Solution 4 - Intellij IdeaDirk SchumacherView Answer on Stackoverflow
Solution 5 - Intellij IdeapinaciView Answer on Stackoverflow
Solution 6 - Intellij IdeasleepyView Answer on Stackoverflow
Solution 7 - Intellij IdeaSpaceTruckerView Answer on Stackoverflow
Solution 8 - Intellij IdeaRaimo JohansonView Answer on Stackoverflow
Solution 9 - Intellij IdeaAntonio Maria Sanchez BerrocalView Answer on Stackoverflow
Solution 10 - Intellij IdeaToddEmonView Answer on Stackoverflow
Solution 11 - Intellij IdeaKocherView Answer on Stackoverflow
Solution 12 - Intellij IdeagluView Answer on Stackoverflow
Solution 13 - Intellij IdeaHamit YILDIRIMView Answer on Stackoverflow