lambdalisue / jupyter-vim-binding

Jupyter meets Vim. Vimmer will fall in love.
2.1k stars 136 forks source link

Interaction with Scratchpad and Keyboard shortcut editor nbextensions #83

Closed omrihar closed 8 years ago

omrihar commented 8 years ago

Summary

I use the Scratchpad nbextension that opens a quick right pane for quick and dirty code trials before adding code to the main notebook. The extension registers to open it. After installing Vim-binding, however, the launching of Scratchpad no longer works.

I tried to use the Keyboard shortcut editor extension to add this keyboard shortcut again but this extension simply doesn't work when vim-bindings is installed. I'm guessing that because vim-bindings rewrites the keyboard shortcuts dialog this breaks the other extension.

I also tried digging in the source code of both Scratchpad and vim-bindings but I don't understand Jupyter internals enough, unfortunately, to see how I can override the shortcut from vim-bindings and use it for Scratchpad instead. (I don't use in vim anyways so I don't mind losing it).

I guess I could probably make it work if I load Scratchpad after loading vim-bindings but I don't know how to affect the loading order of the extensions either. Any help would be very appreciated!

Thanks, Omri

EDIT: I now discovered that vim-bindings breaks Scratchpad even further because the Shift-Enter binding (that Scratchpad monkey-patches) is broken.

Environment

lambdalisue commented 8 years ago

EDIT: I now discovered that vim-bindings breaks Scratchpad even further because the Shift-Enter binding (that Scratchpad monkey-patches) is broken.

https://github.com/minrk/nbextension-scratchpad/blob/master/main.js#L44-L57

It seems Scratchpad provides the following shortcuts:

So assign that shortcut to Shift-Enter with a Keyboard shortcut editor would solve the problem I guess.

Or assigning that shortcut to other key would works as well I guess ;-)

omrihar commented 8 years ago

Hi @lambdalisue, thanks for the quick reply! as i wrote in the issue description, it seems that jupyter-vim-binding breaks keyboard shortcut editor as well because it rewrites the keyboard shortcuts screen (at least I didn't manage to use it).

lambdalisue commented 8 years ago

Oh. I didn't realize that. I'll confirm it and reply the result maybe in this weekend. I'll likely to forget about the issue so ping me if I don't reply even after the weekend ;-)

omrihar commented 8 years ago

@lambdalisue Ping ;-)

lambdalisue commented 8 years ago

Oops sorry.... it may took another week to figure out the way.

Additionally, this issue is equal to #84 so I close this one and continue at #84

DrJimFan commented 6 years ago

Good news! Looks like the problem is automatically resolved when you upgrade to Jupyter 5.0.

Run pip install --upgrade notebook or conda upgrade notebook.