question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Escape goes directly from vim input mode to jupyter command mode

See original GitHub issue

Solution 🎉

Versions 0.15.0 and up do not have this issue. pip install --upgrade jupyterlab-vim

Workaround:

A persistent workaround to this issue is to add the following to the Shortcuts settings (Settings > Advanced Settings Editor > Keyboard Shortcuts)

{ "shortcuts": [
    { 
        "command": "notebook:enter-command-mode",
        "keys": [ "Shift Escape" ],
        "selector": ".jp-Notebook.jp-mod-editMode" 
    },
    {         "command":"notebook:enter-command-mode",
         "keys":[
            "Escape"
         ],
         "selector":".jp-Notebook.jp-mod-editMode",
         "disabled":true
    }]
}

as discovered from https://zhuanlan.zhihu.com/p/105642669 by @gofortargets.


And when I go back in the cell I go directly back to vim input mode. I have to focus another cell, to get vim command mode back.

Peek 2021-03-22 16-23

Is it a problem, that I use two envs, one for jupyter-lab and one for the kernel?

The conda env for jupyter-lab
name: jupyter
channels:
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=1_gnu
  - anyio=2.2.0=py39hf3d152e_0
  - argon2-cffi=20.1.0=py39h3811e60_2
  - async_generator=1.10=py_0
  - attrs=20.3.0=pyhd3deb0d_0
  - babel=2.9.0=pyhd3deb0d_0
  - backcall=0.2.0=pyh9f0ad1d_0
  - backports=1.0=py_2
  - backports.functools_lru_cache=1.6.1=py_0
  - bleach=3.3.0=pyh44b312d_0
  - brotlipy=0.7.0=py39h3811e60_1001
  - ca-certificates=2020.12.5=ha878542_0
  - certifi=2020.12.5=py39hf3d152e_1
  - cffi=1.14.5=py39he32792d_0
  - chardet=4.0.0=py39hf3d152e_1
  - cryptography=3.4.6=py39hbca0aa6_0
  - cycler=0.10.0=py_2
  - decorator=4.4.2=py_0
  - defusedxml=0.7.1=pyhd8ed1ab_0
  - entrypoints=0.3=pyhd8ed1ab_1003
  - freetype=2.10.4=h0708190_1
  - idna=2.10=pyh9f0ad1d_0
  - importlib-metadata=3.7.3=py39hf3d152e_0
  - ipykernel=5.5.0=py39hef51801_1
  - ipympl=0.6.3=pyhd8ed1ab_0
  - ipython=7.21.0=py39hef51801_0
  - ipython_genutils=0.2.0=py_1
  - ipywidgets=7.6.3=pyhd3deb0d_0
  - jedi=0.18.0=py39hf3d152e_2
  - jinja2=2.11.3=pyh44b312d_0
  - jpeg=9d=h36c2ea0_0
  - json5=0.9.5=pyh9f0ad1d_0
  - jsonschema=3.2.0=pyhd8ed1ab_3
  - jupyter-packaging=0.7.12=pyhd8ed1ab_0
  - jupyter_client=6.1.12=pyhd8ed1ab_0
  - jupyter_core=4.7.1=py39hf3d152e_0
  - jupyter_server=1.4.1=py39hf3d152e_0
  - jupyterlab=3.0.12=pyhd8ed1ab_0
  - jupyterlab_pygments=0.1.2=pyh9f0ad1d_0
  - jupyterlab_server=2.3.0=pyhd8ed1ab_0
  - jupyterlab_widgets=1.0.0=pyhd8ed1ab_1
  - kiwisolver=1.3.1=py39h1a9c180_1
  - lcms2=2.12=hddcbb42_0
  - ld_impl_linux-64=2.35.1=hea4e1c9_2
  - libblas=3.9.0=8_openblas
  - libcblas=3.9.0=8_openblas
  - libffi=3.3=h58526e2_2
  - libgcc-ng=9.3.0=h2828fa1_18
  - libgfortran-ng=9.3.0=hff62375_18
  - libgfortran5=9.3.0=hff62375_18
  - libgomp=9.3.0=h2828fa1_18
  - liblapack=3.9.0=8_openblas
  - libopenblas=0.3.12=pthreads_h4812303_1
  - libpng=1.6.37=h21135ba_2
  - libsodium=1.0.18=h36c2ea0_1
  - libstdcxx-ng=9.3.0=h6de172a_18
  - libtiff=4.2.0=hdc55705_0
  - libwebp-base=1.2.0=h7f98852_2
  - lz4-c=1.9.3=h9c3ff4c_0
  - markupsafe=1.1.1=py39h3811e60_3
  - matplotlib-base=3.3.4=py39h2fa2bec_0
  - mistune=0.8.4=py39h3811e60_1003
  - nbclassic=0.2.6=pyhd8ed1ab_0
  - nbclient=0.5.3=pyhd8ed1ab_0
  - nbconvert=6.0.7=py39hf3d152e_3
  - nbformat=5.1.2=pyhd8ed1ab_1
  - ncurses=6.2=h58526e2_4
  - nest-asyncio=1.4.3=pyhd8ed1ab_0
  - notebook=6.3.0=py39hf3d152e_0
  - numpy=1.20.1=py39hdbf815f_0
  - olefile=0.46=pyh9f0ad1d_1
  - openssl=1.1.1j=h7f98852_0
  - packaging=20.9=pyh44b312d_0
  - pandoc=2.12=h7f98852_0
  - pandocfilters=1.4.2=py_1
  - parso=0.8.1=pyhd8ed1ab_0
  - pexpect=4.8.0=pyh9f0ad1d_2
  - pickleshare=0.7.5=py_1003
  - pillow=8.1.2=py39hf95b381_0
  - pip=21.0.1=pyhd8ed1ab_0
  - prometheus_client=0.9.0=pyhd3deb0d_0
  - prompt-toolkit=3.0.17=pyha770c72_0
  - ptyprocess=0.7.0=pyhd3deb0d_0
  - pycparser=2.20=pyh9f0ad1d_2
  - pygments=2.8.1=pyhd8ed1ab_0
  - pyopenssl=20.0.1=pyhd8ed1ab_0
  - pyparsing=2.4.7=pyh9f0ad1d_0
  - pyrsistent=0.17.3=py39h3811e60_2
  - pysocks=1.7.1=py39hf3d152e_3
  - python=3.9.2=hffdb5ce_0_cpython
  - python-dateutil=2.8.1=py_0
  - python_abi=3.9=1_cp39
  - pytz=2021.1=pyhd8ed1ab_0
  - pyzmq=22.0.3=py39h37b5a0c_1
  - readline=8.0=he28a2e2_2
  - requests=2.25.1=pyhd3deb0d_0
  - send2trash=1.5.0=py_0
  - setuptools=49.6.0=py39hf3d152e_3
  - six=1.15.0=pyh9f0ad1d_0
  - sniffio=1.2.0=py39hf3d152e_1
  - sqlite=3.34.0=h74cdb3f_0
  - terminado=0.9.3=py39hf3d152e_0
  - testpath=0.4.4=py_0
  - tk=8.6.10=h21135ba_1
  - tornado=6.1=py39h3811e60_1
  - traitlets=5.0.5=py_0
  - tzdata=2021a=he74cb21_0
  - urllib3=1.26.4=pyhd8ed1ab_0
  - wcwidth=0.2.5=pyh9f0ad1d_2
  - webencodings=0.5.1=py_1
  - wheel=0.36.2=pyhd3deb0d_0
  - widgetsnbextension=3.5.1=py39hf3d152e_4
  - xz=5.2.5=h516909a_1
  - zeromq=4.3.4=h9c3ff4c_0
  - zipp=3.4.1=pyhd8ed1ab_0
  - zlib=1.2.11=h516909a_1010
  - zstd=1.4.9=ha95c52a_0
  - pip:
    - jupyterlab-vim==0.13.0
The conda env for the kernel
name: main
channels:
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - attrs=20.3.0=pyhd3eb1b0_0
  - backcall=0.2.0=pyhd3eb1b0_0
  - blas=1.0=mkl
  - ca-certificates=2021.1.19=h06a4308_1
  - certifi=2020.12.5=py38h06a4308_0
  - cycler=0.10.0=py38_0
  - dbus=1.13.18=hb2f20db_0
  - decorator=4.4.2=pyhd3eb1b0_0
  - expat=2.2.10=he6710b0_2
  - fontconfig=2.13.1=h6c09931_0
  - freetype=2.10.4=h5ab3b9f_0
  - glib=2.67.4=h36276a3_1
  - gmp=6.2.1=h2531618_2
  - gmpy2=2.0.8=py38hd5f6e3b_3
  - gst-plugins-base=1.14.0=h8213a91_2
  - gstreamer=1.14.0=h28cd5cc_2
  - icu=58.2=he6710b0_3
  - importlib-metadata=3.7.3=py38h06a4308_1
  - importlib_metadata=3.7.3=hd3eb1b0_1
  - intel-openmp=2020.2=254
  - ipykernel=5.3.4=py38h5ca1d4c_0
  - ipython=7.21.0=py38hb070fc8_0
  - ipython_genutils=0.2.0=pyhd3eb1b0_1
  - jedi=0.17.2=py38h06a4308_1
  - jpeg=9b=h024ee3a_2
  - jsonschema=3.2.0=py_2
  - jupyter_client=6.1.7=py_0
  - jupyter_core=4.7.1=py38h06a4308_0
  - kiwisolver=1.3.1=py38h2531618_0
  - lcms2=2.11=h396b838_0
  - ld_impl_linux-64=2.33.1=h53a641e_7
  - libffi=3.3=he6710b0_2
  - libgcc-ng=9.1.0=hdf63c60_0
  - libgfortran-ng=7.3.0=hdf63c60_0
  - libpng=1.6.37=hbc83047_0
  - libsodium=1.0.18=h7b6447c_0
  - libstdcxx-ng=9.1.0=hdf63c60_0
  - libtiff=4.2.0=h3942068_0
  - libuuid=1.0.3=h1bed415_2
  - libwebp-base=1.2.0=h27cfd23_0
  - libxcb=1.14=h7b6447c_0
  - libxml2=2.9.10=hb55368b_3
  - lz4-c=1.9.3=h2531618_0
  - matplotlib=3.3.4=py38h06a4308_0
  - matplotlib-base=3.3.4=py38h62a2d02_0
  - mkl=2020.2=256
  - mkl-service=2.3.0=py38he904b0f_0
  - mkl_fft=1.3.0=py38h54f3939_0
  - mkl_random=1.1.1=py38h0573a6f_0
  - mpc=1.1.0=h10f8cd9_1
  - mpfr=4.0.2=hb69a4c5_1
  - mpmath=1.1.0=py38_0
  - nbformat=5.1.2=pyhd3eb1b0_1
  - ncurses=6.2=he6710b0_1
  - numpy=1.19.2=py38h54aff64_0
  - numpy-base=1.19.2=py38hfa32c7d_0
  - olefile=0.46=py_0
  - openssl=1.1.1j=h27cfd23_0
  - pandas=1.2.3=py38ha9443f7_0
  - parso=0.7.0=py_0
  - pcre=8.44=he6710b0_0
  - pexpect=4.8.0=pyhd3eb1b0_3
  - pickleshare=0.7.5=pyhd3eb1b0_1003
  - pillow=8.1.2=py38he98fc37_0
  - pip=21.0.1=py38h06a4308_0
  - plotly=4.14.3=pyhd3eb1b0_0
  - prompt-toolkit=3.0.17=pyh06a4308_0
  - ptyprocess=0.7.0=pyhd3eb1b0_2
  - pygments=2.8.1=pyhd3eb1b0_0
  - pyparsing=2.4.7=pyhd3eb1b0_0
  - pyqt=5.9.2=py38h05f1152_4
  - pyrsistent=0.17.3=py38h7b6447c_0
  - python=3.8.8=hdb3f193_4
  - python-dateutil=2.8.1=pyhd3eb1b0_0
  - pytz=2021.1=pyhd3eb1b0_0
  - pyzmq=20.0.0=py38h2531618_1
  - qt=5.9.7=h5867ecd_1
  - readline=8.1=h27cfd23_0
  - retrying=1.3.3=py_2
  - scipy=1.6.1=py38h91f5cce_0
  - setuptools=52.0.0=py38h06a4308_0
  - sip=4.19.13=py38he6710b0_0
  - six=1.15.0=py38h06a4308_0
  - sqlite=3.35.2=hdfb4753_0
  - sympy=1.7.1=py38h06a4308_0
  - tk=8.6.10=hbc83047_0
  - tornado=6.1=py38h27cfd23_0
  - traitlets=5.0.5=pyhd3eb1b0_0
  - wcwidth=0.2.5=py_0
  - wheel=0.36.2=pyhd3eb1b0_0
  - xz=5.2.5=h7b6447c_0
  - zeromq=4.3.4=h2531618_0
  - zipp=3.4.1=pyhd3eb1b0_0
  - zlib=1.2.11=h7b6447c_3
  - zstd=1.4.5=h9ceee32_0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:34
  • Comments:50

github_iconTop GitHub Comments

9reactions
ianhicommented, Feb 11, 2022

At long last I have a PR with a possible permanent fix here: https://github.com/jupyterlab-contrib/jupyterlab-vim/pull/57 🎉

would appreciate it if other people could try it out to confirm it works.

8reactions
MarcoGorellicommented, Apr 28, 2021

This happens to me too, but if I use ctrl+[ instead of Esc then it works fine 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Escape doesn't bring back Jupyter mode · Issue #53 - GitHub
Escape key does nothing when in vim command mode. Step by step procedure. Open notebook file; Press "i" to enter vim mode; Press...
Read more >
IdeaVim 1.9.1, PyCharm 2021.3: escape doesn't work in ...
Workaround is to go back to a Jupyter notebook and enter a cell. Go between insert mode and normal mode. Immediately go to...
Read more >
Exit insert mode in the JupyterLab using vim keybindings
But when trying to exit insert mode using the 'esc' key I just get toggled out of the current window. Is this not...
Read more >
jupyterlab-vim - PyPI
Jupyterlab Command mode is when the cursor is not in a specific cell, and edit mode when typing in a cell.
Read more >
How to exit the Vim editor? / Abhishek Chaudhary - Observable
From INSERT mode, you need to push ESC, i.e. the Escape button, going to COMMAND mode, and then : to go to EX...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found