Customizing notebook shortcuts

187 views
Skip to first unread message

Florian Aspart

unread,
Jun 15, 2015, 4:26:07 AM6/15/15
to jup...@googlegroups.com
Hi everybody,

I'm having some troubles with the keyboards shortcuts in the IPython Notebook.

I'd like to use the indent and dedent shortcuts (Ctrl + ] and Ctrl + [ ), but I guess these shortcuts were designed for US or British keyboards.
I'm currently using a german keyboard and to access the "[" and "]" I need to press "AltGr", which is not compatible with the Ctrl button.
In short, these key combinations does not work for me and I cannot use these shortcuts.

Is there a way to personalize the keyboard shortcuts?

Best,
Florian

Matthias Bussonnier

unread,
Jun 15, 2015, 10:44:55 AM6/15/15
to jup...@googlegroups.com
Hi Florian,


I'm having some troubles with the keyboards shortcuts in the IPython Notebook.

I'd like to use the indent and dedent shortcuts (Ctrl + ] and Ctrl + [ ), but I guess these shortcuts were designed for US or British keyboards.

Yes, mostly, I myself have a french Keyboard, and is aware that some keyboard don’t work. 
The keyboard you are talking about in particular are From CodeMirror (the underlying library we use
for code edition). So I’m not sure exactly how it work. 

You can try to investigate here:

I'm currently using a german keyboard and to access the "[" and "]" I need to press "AltGr", which is not compatible with the Ctrl button.
In short, these key combinations does not work for me and I cannot use these shortcuts.


Unfortunately, the keyboard shortcut are detected by javascript, and the browser vendors don’t seem to be interested in providing 
an API that would allow to detect correctly the user intent. It is not lack of having tried, but first things there is no way to detect
the keyboard layout. So if remap you do you will sadly have to  do some things on your own. 

This issue [1] have someone in the same situation, and link to workaround (mainly using shift-tab.

We are slowly working on documenting keyboards shortcut, it’s a complex problem. I have written some explanation on how it works here [2]
it might help you to customize a limited number of actions.

Is there a way to personalize the keyboard shortcuts?

I’m sorry there is no definitive answer, I still hope that the links will help a bit. 
Tell us what you find out. 

— 
Matthias


[2] http://carreau.gitbooks.io/jupyter-book/content/keyboardshortcut.html

Florian Aspart

unread,
Jun 16, 2015, 4:40:02 AM6/16/15
to jup...@googlegroups.com
Hi Matthias,

thank you for your rapid answer.

I was actually misunderstanding the meaning of "indent" and "dedent" in the shortcuts descriptions. I was hoping  to use these shortcuts to achieve an indentation within a line and not indenting the whole line. For indenting the whole line, I'm already highlighting the whole line and pressing tab (as described in the github link you provided).

What I intended to do would correspond to the "insertSoftTab" keymapping of Code Mirror.
I guess I would need to dig into the CodeMirror API add these shortcut.

Unfortunately, I do not have much time to implement this now, but if I find some time to do it, I'll post here my solution.

Best,
Florian


--
You received this message because you are subscribed to a topic in the Google Groups "Project Jupyter" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jupyter/Xtl8A0UCw2Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/27B89FF4-994E-4E0B-A1D2-2165336970D8%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages