jwkvam / jupyterlab-vim

:neckbeard: Vim notebook cell bindings for JupyterLab
MIT License
973 stars 73 forks source link

Extension migration for JupyterLab 2.x #115

Open axelfahy opened 4 years ago

axelfahy commented 4 years ago

Modifications have been done according to the migration guide: https://jupyterlab.readthedocs.io/en/stable/developer/extension_migration.html

This should close #113

Please finish the following when submitting a pull request:

If this is a release, additionally do the following:

Thanks!

walkerqt commented 4 years ago

Already used your code. Thanks!

axelfahy commented 4 years ago

Your welcome, while this or another solution gets merged, I have published the npm package as @axlair/jupyterlab_vim as a temporary solution.

zaneselvans commented 4 years ago

Thanks so much for making these updates! I've just installed the extension you published to temporarily replace jupyterlab_vim but for some reason it doesn't seem to be taking effect. I've rebuilt Jupyter both via the web interface and at the command line and it still gives me the default keybindings, even though your extension is shown as installed and working, in both the web and command line interface. E.g.

$ jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: /home/zane/miniconda3/envs/pudl-dev/share/jupyter/lab
        @axlair/jupyterlab_vim v0.12.1  enabled  OK
        nbdime-jupyterlab v1.0.0 disabled  X

   The following extension are outdated:
        nbdime-jupyterlab

Seems odd. Is there anything else that needs to be done to make the extension active?

axelfahy commented 4 years ago

I don't think there is anything else to do to activate the extension. Maybe one of your browser's extension is conflicting with the plugin. I am using Firefox and I don't have any issue, however on Chromium, if I have the plugin Vimum activated on the page, the jupyterlab_vim plugin is not working.

kevlubkcm commented 4 years ago

@zaneselvans I had a similar issue. resolved it by clearing out my virtual env entirely and rebuilding from scratch

jmrichardson commented 4 years ago

Hi, I am not too familiar with npm, but i did the following and it doesn't seem to be working:


(jupyterlab) D:\Projects>npm i @axlair/jupyterlab_vim
npm WARN saveError ENOENT: no such file or directory, open 'D:\Projects\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\Projects\package.json'
npm WARN Projects No description
npm WARN Projects No repository field.
npm WARN Projects No README data
npm WARN Projects No license field.

+ @axlair/jupyterlab_vim@0.12.2
updated 1 package and audited 236788 packages in 1.604s

15 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

(jupyterlab) D:\Projects>jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: D:\Anaconda3\envs\jupyterlab\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v2.0.0 enabled  ok
        @jupyterlab/debugger v0.2.0 enabled  ok
        @jupyterlab/github v2.0.0 enabled  ok
        @jupyterlab/shortcutui v0.5.0-beta.2 enabled  ok
        @jupyterlab/toc v3.0.0 enabled  ok
        @lckr/jupyterlab_variableinspector v0.5.0 enabled  ok
        qgrid2 v1.1.2 enabled  ok

What am I doing wrong? TIA

Solution:

Got it to work. Cloned your repository and did:

jupyter labextension install .

Thanks for this work

Sh4pe commented 4 years ago

I'm really looking forward to use the vim plugin in Jupyter Lab 2.0. :)

nmvega commented 4 years ago

Your welcome, while this or another solution gets merged, I have published the npm package as @axlair/jupyterlab_vim as a temporary solution.

Hello! =:) Thank you for this, firstly.

I'm getting the following exception. Am I applying this incorrectly, or it's correct but my versions are not supported?

root# /opt/tljh/user/bin/jupyter labextension install jupyterlab_vim
An error occured.
ValueError: The extension "jupyterlab_vim" does not yet support the current
version of JupyterLab.

Conflicting Dependencies:
JupyterLab              Extension      Package
>=2.1.0 <2.2.0          >=1.0.1 <2.0.0 @jupyterlab/application
>=2.1.0 <2.2.0          >=1.0.1 <2.0.0 @jupyterlab/notebook
See the log file for details:  /root/.temp.d/jupyterlab-debug-esw3phkv.log

Thank you!

axelfahy commented 4 years ago

What is your jupyterlab version? Have you tried in a new environment with a fresh installation of jupyterlab?

nmvega commented 4 years ago

@axelfahy Hi. Yes its a fresh install of TLJH, as of last night (EDT). In fact, I always build it as code from a Dockerfile for build consistency and quality, which includes steps for pip(1) updating packages in both the HUB and USER virtual environments of TLJH. So JupyterLabs version is v2.1.x. I have to check the actual version because, ironically, v2.1.1 was released 7-hours ago and I'm unsure if I rebuilt it slightly before that was released. But it's v2.1.x, for sure.

TheGhostHuCodes commented 4 years ago

Hi @nmvega,

Did you execute this command to install @axelfahy 's build? jupyter labextension install @axlair/jupyterlab_vim

I think executing: jupyter labextension install jupyterlab_vim will install the current master build of the jupyterlab_vim labextension, which does not support JupyterLab 2.X until this PR is merged.

nmvega commented 4 years ago

@TheGhostHuCodes Hello! I did not try that variation. I'm unfamiliar with the @ syntax unfortunately (which I guess means pull from the specified npm repository?), but I will try your suggestion in an hour or so and report back. :blush:

nmvega commented 4 years ago

@TheGhostHuCodes Hello! I did not try that variation. I'm unfamiliar with the @ syntax unfortunately (which I guess means pull from the specified npm repository?), but I will try your suggestion in an hour or so and report back.

@TheGhostHuCodes @axelfahy Hello! The variation that @TheGhostHuCodes proposed worked, just now. \o/

So for the those visiting here, the complete solution is:

root# /opt/tljh/user/bin/pip install --upgrade jupyterlab  # Upgraded from v2.1.0 to v2.1.1

root# /opt/tljh/user/bin/jupyter labextension install @axlair/jupyterlab_vim
Building jupyterlab assets (build:prod:minimize)
root#

I then reloaded my JupyterLab and Notebook sessions, and now vim(1) key-bindings work.

Notice that I did this under the USER environment of TLJH; however the above will likely work for you in any JupyterLab setting (like running it on your laptop).

@axelfahy Thank for you this solution. I've been using vi(1)/vim(1) since the days when I was stuck in many cold datacenters with only a vt100 terminal and a Sun / Solaris UNIX CLI prompt. I simply can't use arrow keys for navigation anymore. =:)