Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JupyterLab: keyboard shortcut to toggle next/previous tabs in JupyterLab

Tags:

jupyter-lab

Does anyone know if there is a keyboard shortcut to toggle next / previous tabs in JupyterLab (if there is, how to do it)? or if we can customize keyboard shortcuts?

EDIT

This youtube shows how you can customize your keyboard shortcuts in JupyterLab. I tried it and it works for me.

like image 862
wi3o Avatar asked Feb 26 '18 17:02

wi3o


People also ask

How do I switch between tabs in Jupyterlab?

"[" and "]" on an international keyboard are the two keys right of "p". On the German keyboard "ä" and "+". "ctrl shift ä" switches to the left/previous tab as expected.

How do I toggle between tabs?

Switch to the Next Tab To jump to the next tab (on the right) press Ctrl + Tab or Ctrl + PgDn on your keyboard. This shortcut works perfectly on Windows devices and other operating systems (e.g Chrome OS on Chromebooks and Linux) with a familiar keyboard layout.

How do you jump to the next cell in Jupyter Notebook?

Shift + Enter run the current cell, select below. Ctrl + Enter run selected cells. Alt + Enter run the current cell, insert below. Ctrl + S save and checkpoint.


2 Answers

If you click the "Tabs" menu in Jupyter Lab, the keyboard shortcut should be listed there.

example: On my macbook it is CTRL+SHIFT+[ or CTRL+SHIFT+]

like image 180
warvolin Avatar answered Sep 18 '22 09:09

warvolin


Answer for German - (and other non-international) keyboards:

Since the previous answer does not work on a German keyboard I describe the problem for this keyboard and then I describe a solution for this keyboard which shall work similarly on other keyboards as well.

1. Problem with current settings

"[" and "]" on an international keyboard are the two keys right of "p". On the German keyboard "ä" and "+". "ctrl shift ä" switches to the left/previous tab as expected. But "ctrl shift +" as well as "ctrl shift ]" does not switch to the next/right.

I tried almost every shortcut. But had to change the shortcuts themselves.

2. The problem of choosing a new shortcut

Since "ctrl shift ä" worked as expected I tried to change the other shortcut to "ctrl shift +". And since the other two assignments of the key "+" on a German Keyboard are "*" and "~" I tried "ctrl shift *" and "ctrl shift ~" as well.

After saving, all failed to work, when I tested them.

3. Solution

Here is a description of how to change the shortcuts in Jupyter Lab.

I chose the shortcuts "Ctrl Shift 8" and "Ctrl Shift 9" since “8” and “9” are on the same keys as “[“ and “]”. Then you have to enter the following code as described in the link above.

{   "shortcuts": [         {             "command": "application:activate-previous-tab",             "keys": [                 "Ctrl Shift 8"             ],             "selector": "body"         },         {"command": "application:activate-next-tab",             "keys": [                 "Ctrl Shift 9"             ],             "selector": "body"         }   ] } 
like image 31
Thomas R Avatar answered Sep 18 '22 09:09

Thomas R