New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize keymaps - comment | uncomment toggle #3753
Comments
Unfortunately there are two different shortcut systems in action - Jupyter's own (which that doc explains how to configure), and Codemirror's. Codemirror is the text editor component we use for cells. So most of the editing shortcuts are caught by Codemirror's shortcut system. |
Is there any "way around" or should someone actually go and use the extension to modify keyshortcuts? |
There is some way around, I think, but I can never remember exactly what you need to do. Search for |
Well, I think I do not have to much luck with these shortcuts: ipython-contrib/jupyter_contrib_nbextensions#1321 |
I searched through google and fine some "tutorials" to change the keyboard:
However, they all do not work. Searching the CodeMirror-Side I found the "keyMap" and "extraKeys" options that you could you during the instantiation of the editor (havent tried it yet). Looking into the addons of CodeMirror (comment.js), they toggleComment-Function is still there (same name). In the keymap e.g for instance it is called: { "Ctrl-/": "toggleCommentIndented" } I might be thinking to easy, but the whole issue for None-US keyboards could then be solved by adding an "extraKey", for instance: extraKey = {'Ctrl+Shift+7': "toggleCommentIndented}. How can you access CodeMirror the easierst way? Could you put me on the right track here? Should someone create a custom.js and access codemirror there? |
I ve been playing around, while I found out that the toggleComment is here: Jupyter.Cell.options_default.cm_config.extraKeys It still has no effect, whether I change the key in the console or in a config.js File. What am I missing? |
Well, so changing anything on the Cell object had no effect. The only thig that worked finally was the following (custom.js in .jupyter/custom folder): define([ This toggles lines no by using Ctrl and 7. |
I've the same problem!! |
Any chance of getting this to be part of a configurable option? |
I solved it like I described here: https://stackoverflow.com/a/71480779/7056765 |
Well, I am getting a bit frustrated. I tried to unbind the key for commenting in edit mode following the instructions that are given here: http://jupyter-notebook.readthedocs.io/en/stable/extending/keymaps.html - but the unbinding never took place.
Consequently, also the re-binding, for instance to "Ctrl-7" never worked as well (German keyboard).
So could maybe someone please provide an example configuration or tell me whether this is unexpected behavior or a case of "uts" (user to stupid)?
I ve been playing around with this for a while now and cd not solve it.
The text was updated successfully, but these errors were encountered: