Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ctrl-N in emacs keybindings for Jupyter notebook in Chrome

I'm using Jupyter notebooks in the Chrome browser. I've installed nbextensions and am using the emacs keybindings. Most keys work as expected, even those that conflict with Chrome shortcuts, like ctrl-P. But ctrl-N still opens a new window. I've tried Shortkeys, with which I can set ctrl-N to "do nothing", but it is not passed through to the notebook. I tried AutoControl Shortcut Manager and have the same problem.

Old answers to this question say that you can't override ctrl-N at all, which is no longer true in the newer versions of Chrome, but how do you stop the default behavior and allow the key to pass through to the page?

like image 857
Llaves Avatar asked May 11 '19 22:05

Llaves


People also ask

How do I access jupyter notebook in Chrome?

For example to open the jupyter notebook in Google Chrome: Open Chrome, go to Settings, select the Default Browser tab, and make Chrome as your default browser. After this, the jupyter notebook will always open in Chrome.

How do I make a shortcut for a jupyter notebook?

Windows will open a system folder ( C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Anaconda2 (64-bit) ) in the Explorer app, and highlight the Jupyter shortcut. … then paste to your desktop (you can also click and drag “Jupyter Notebook” onto your desktop, or use Ctrl-C and Ctrl-V ).

What is the shortcut to get to the next line in a jupyter notebook?

Just add <br> where you would like to make the new line. Because jupyter notebook markdown cell is a superset of HTML.


1 Answers

You can do this with AutoControl Shortcut Manager by using the SYNTHESIZE INPUT action to send a synthetic Ctrl+N from the inside of the webpage.

That way, the webpage will respond to the shortcut but not the browser.

This is how you do it: Send Ctrl+N from inside webpage

  1. Set Ctrl+N as the trigger

  2. Choose SYNTHESIZE INPUT as the action and enter the keystroke Ctrl+N

  3. Select option Send from the inside of webpage

Now, whenever you press Ctrl+N, Chrome will do nothing, but the webpage will receive the keystroke and will react to it.

Of course, you'd only want to do this on those Jupyter Notebook pages, so make sure you add a URL condition to that trigger.

like image 52
AutoControl.app Avatar answered Jan 02 '23 22:01

AutoControl.app