90

What is the equivalent of CTRL + SLASH on german keyboards?

I know that US-Layouts got that / where the german _ is, since I used an US-Layout for some time. But CTRL + _ just collapses a method.

2
  • Is there a slash above the 7? Have you tried CTRL+SHIFT+7 for that?
    – Makoto
    Commented Dec 27, 2015 at 23:42
  • @Makoto: Yeah of course. Sry that I didn't mention it.
    – codepleb
    Commented Dec 28, 2015 at 7:19

17 Answers 17

105

Just use the slash (Ctrl + /) on the numpad.

6
  • 9
    This works! Although it's more of a "temporary" solution since I often code on my laptop. :)
    – codepleb
    Commented Dec 30, 2015 at 8:24
  • 3
    Nice idea. But it doesn't work for block comments (Ctrl+Shift+Slash)
    – Dominik
    Commented May 19, 2016 at 9:26
  • 3
    If you are using you laptop (without numpad) your keyboard layout might allow to emulate the numpad (often using the [Fn]-key). Commented Aug 19, 2016 at 7:08
  • I can confirm it works with the Function Key which emulates the NumPad on a laptop and the corresponding slash.
    – Waschbaer
    Commented Nov 2, 2017 at 19:06
  • 1
    have no numpad ;)
    – noBillSide
    Commented Aug 9, 2021 at 6:57
32

I found a solution for using the desired shortcut on Intellij Idea.

You just need to:
- click Ctrl+Alt+S to open the settings dialog box, - choose "Keymap" from the left menu
- then search for keyword "comment".
- right click on "Comment with Block comment" and select add Keyboar Shortcuts.
- Type the shortcut you want to use and click ok.
For more details : https://www.jetbrains.com/help/idea/2016.3/configuring-keyboard-shortcuts.html

1
  • 6
    I hate remapping things because of language settings. You will have to do this all the time you reinstall it or change the VM, etc. I started using the US-Layout on macos (struggle at home with windows, because there is no easy method to use ä, ö, ü) but apart from that it's a dream to code with. All the special characters are so easy accessible. :)
    – codepleb
    Commented Jul 6, 2017 at 7:03
21

I just changed Ctrl + Slash and Ctrl + Shift + Slash to Ctrl + 7 and Ctrl + Shift + 7. Works as expected, as they are the same key on german keyboards.

Problem is Ctrl + Shift + 7 is used for bookmarking a line, so I have to override this shortcut.

3
  • Why not use CMD+SHIFT+7?
    – frhd
    Commented Sep 14, 2018 at 13:49
  • 1
    @frhd you might use every shortcut you want, but the default is Ctrl + Slash. This is a problem, as slash and 7 are the same keys on a German key board.
    – ppasler
    Commented Sep 17, 2018 at 6:44
  • 1
    I just realised it's the basically the same thing. My bad :)
    – frhd
    Commented Sep 17, 2018 at 9:58
14

As of today it is still an unresolved IDEA issue, see this https://youtrack.jetbrains.com/issue/IDEA-16116.

Defining a custom keymap seems to be the best solution.

10

A little late to the party, but maybe it helps someone... I'm using Ubuntu 16.04 with the gnome desktop. I frequently switch between the german and english keyboard layout.

In order to be able to use IntelliJ shortcuts with the english layout I had to change the order of the layouts in my system settings: (gnome desktop) > settings > keyboard > Input source (top right corner) There you find all configured input sources. I moved "english" to the top.

Now I can use all shortcuts based on the english layout, even when I switch to german. This means e.g. Ctrl + _ with the german or Ctrl + / with english layout would be line-comment in IntelliJ.

1
  • 1
    +1, I think this is the closest you can get to "perfection". Another idea that pushes my brain is to set the layouts of all my devices to "English US International". I can write the umlauts with that one and still have all the nice shortcuts (how they are MEANT to be used :P).
    – codepleb
    Commented Feb 4, 2017 at 18:03
4

Not really an answer but I found this while googling and unfortunately had to add a custom keymap, too.

I now have it on CMD + ß. The combination is not used (which makes sense due to its QWERTZ relation). Works for me.

3

I just discovered that STRG(CTRL) + # works for my QWERTZ-Keyboard. Hope it helps somebody!

0
3

If you are on macOS (MacBook, ...) and have a German keyboard you can make the command + / keymap work like this:

Step 1 - macOS settings

Disable the "Hilfemenü anzeigen" ("Open the Help menu") shortcut in the keyboard settings of macOS:

Hilfemenü anzeigen shoortcut on macOS

Step 2 - IDEA settings

In the keymap preferences of IntelliJ IDEA (or Android Studio) add the keymap shift + command + 7 for "Comment with Line Comment". Note: I used the "macOS" keymap settings as the basis, and adding a keymap will create your personal copy of the settings.

keymap for Comment with Line Comment

Now it should work the same way as in Visual Studio Code for example.

0
2

In my current version of IDEA v.20221.1.4 there is an option "Use national layouts for shortcuts (require restart)". Activate it, nothing changed. Then I check the documents of IDEA, it says you need to install the "Keymap Nationalized" plugin to use it. Deatails about this plugin can be found here: https://plugins.jetbrains.com/plugin/14625-keymap-nationalizer After install this plugin in IDEA. Double click "Shift" button in IDEA, the "search every" windows will be opened. Find the setting for Keymap Nationalized plugin. Now you can choose the language for the keymap. You will see new keymaps were added, for example there is a new keymap for the Comment with line added. Keymap Setting of IDEA

About the option "Use national layouts for shortcuts"

Setting of Keymap Nationalized plugin in IDEA

Choose the language for the keymap

new keymap was added for comment with line

2

It's been almost 4.5 years and I just want to share with you guys, which route I took because of only this issue (more or less). Sorry that this is not an answer in the proper stackoverflow manner.

I switched my keyboard setting to "US - International" and only use this one for everything I do nowadays. You can have the umlauts (by pressing Shift + ä and then your desired letter) on windows and macos. An all the "special keys" feel so much more natural! While you have to do finger-splits for certain characters, they use AT MAX the shift key on US layouts. Feels so much nicer to write and code like that!

I know, this is probably not what you are going to do, but I can tell you, that I find more and more people who did that and not a single one of them regretted that. Obviously that means, that you should be able to type blindly. :) At least, most keyboard I use, don't have the US layout on it. I adapted to it pretty fast though.

So basically, having the umlauts takes a tiny little bit more effort, but this is really worth it, because everything else makes so much sense on the US layout and you will get all the keymaps as they were intended to be used. Not those crappy "translations" that sometimes don't make sense, like this annoying line-comment thingy here.

Update 2021: Compare how you write those characters on a US layout compared to whichever layout you are using. There are dramatically less keys involved in using those chars and I can write them faster and also with less wear and tear on my fingers.

;
:
/
`
'
@
<>
[]
{}
3
  • Wow, an answer such this after 5 years, means that really worked for you. If as I believe let read the laptop its keyboard as US instead of as German make much life easier for developing purpose and the only issue is to loose native umlauts letters, then I will give this approach a try Commented Jun 28, 2021 at 9:13
  • @CarmineTambascia Yes. I was already able to write blindly (numbers were most cumbersome at first). But being able to use all shortcuts on all tools you use like they were "intented to be used", it's just so refreshing. No googling for all the tools how to workaround it, no reinstalling of all the plugins after you wipe your system or create a new VM and so on. But keep in mind, the umlauts you can only do easily with the "US - International" layout! As long as you don't need them and write in english, you can also use "US", which is the same but with less key combinations. :)
    – codepleb
    Commented Aug 4, 2021 at 12:24
  • Almost 9 years already. Dayum, time flies... Still kicking with the US layout. It seems to me that more and more devs switch over (not because of me but in general).
    – codepleb
    Commented Jul 28 at 21:09
1

I also struggle with this shortcut and could'nt find the right combination. The only solution i found is to change to English keybord layout using Alt+Shift and then use Strg+Underscore for commenting and back to german layout Alt+Shift. This helps for the moment. Hope for a better solution.

1

I solved this by changing the shortcut. You can do this the following way:

  1. In Android Studio in the top menu, click on Android Studio->Preferences...
  2. A new window pops up, in the side menu of it select Keymap. Now you see a list. Click on Main menu -> Code -> Comment with Line Comment (doubleclick) -> add keyboard shortcut.
  3. A small window pops up. You can now simply press the shortcut you prefer and click ok.
  4. Don't forget to save your changes by clicking OK or Apply.

The configured shortcut should work immediately.

0

Copying over a solution I found in one of the comments in Jetbrain's bug tracker (see https://youtrack.jetbrains.com/issue/JBR-216#focus=Comments-27-4838035.0-0 )

[...]

I found the plugin "Keyboard Nationalizer". Install the Plugin, restart IntelliJ and execute the Action "Generate National Keymap" - that's it.

After generating a German layout, the shortcuts can be used again

0

If you have a numpad, try using command + /(from the numpad). It worked for me.

0
0

Just holding down Alt press C, release C and press L.

That's it.

Short: Alt+C, Alt+L

(IntelliJ IDEA 2023.2.5)

-1

For MacBook Pro & Air, command + shift + 7 works fine in Visual Studio Code.

-1

to comment:

command k c 

to uncomment:

command k u
1
  • 2
    Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation? Commented Jan 19 at 6:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.