SmCaterpillar
SmCaterpillar

Reputation: 7020

How can I block comment code in an IPython notebook with a German keyboard?

How can I block comment a selected text in an IPython Notebook with a German keyboard layout? Ctrl-/ does not work, which on a German keyboard actually is Ctrl-Shift-7.

Upvotes: 13

Views: 12016

Answers (6)

F K
F K

Reputation: 11

I found a comment by AlexanderMelde on GitHub which helped me out that is worked for me:

Strg + /

using the devide key from the numpad instead of the one with the "7" works for me with German keyboard layout.

Hope it also works for you!

Upvotes: 1

Emil Lykke Jensen
Emil Lykke Jensen

Reputation: 409

On a Nordic keybord (and I think this goes for German as well) simply hit Ctrl+Shift+7 (=Ctrl+/)

Upvotes: 0

Bahry Jarbou
Bahry Jarbou

Reputation: 1

Well after trying every combination with ctrl, voilà, ctrl-# does the job.

Upvotes: 0

Createdd
Createdd

Reputation: 1065

I used it with nbextensions. Install it. See docs here

Then, in your nbconfig.

enter image description here

Just configure it with your personal preference. I am using german keyboard and used this implementation successfully for months.

Upvotes: 2

Robbotnik
Robbotnik

Reputation: 545

I found this great workaround for international keyboard layouts from Dataman in How do I comment out multiple lines in Jupyter Ipython notebook?

Press the Alt button and keep holding it. The cursor should change its shape into a big plus sign. The next step is, using your mouse, to point to the beginning of the first line you want to comment and while holding the Alt button pull down your mouse until the last line you want to comment. Finally, you can release the Alt button and then use the # character to comment.

Upvotes: 13

Fabian Rost
Fabian Rost

Reputation: 2414

You can define custom keyboard shortcuts in custom.js. For Jupyter this file is located in .jupyter/custom/. On a German keyboard layout I use Ctrl + , as a shortcut to comment by adding this to custom.js:

define([
    'base/js/namespace',
    'base/js/events'
    ],
    function(IPython, events) {
        events.on("app_initialized.NotebookApp",
            function () {
                IPython.Cell.options_default.cm_config.extraKeys = {"Ctrl-," : "toggleComment"};
            }
        );
    }
);

Upvotes: 0

Related Questions