jupyterlab-contrib / jupyterlab-vim

Vim notebook cell bindings for JupyterLab
https://jupyterlab-contrib.github.io/jupyterlab-vim.html
MIT License
661 stars 43 forks source link

Inserting / appending in visual mode doesn't work #80

Closed MatusGasparik closed 1 year ago

MatusGasparik commented 1 year ago

Description

When selecting multiple lines using the vim's visual mode the inserting (with I / shift-i) or appending (with A / shift-a) doesn't work. The inserting happens only on the current line, but not the entire selected block. The appending at the end of each line doesn't even work for the current line (it simply does the "normal" a append at the cursor possition).

Reproduce

Using some multi-line dummy text:

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed diam nonumy eirmod tempor invidunt ut labore et dolore 
magna aliquyam erat, sed diam voluptua. At vero eos et accusam 
et justo duo dolores et ea rebum. Stet clita kasd gubergren, 
no sea takimata sanctus est Lorem ipsum dolor sit amet. 
  1. Navigate to any line and select multiple lines with V / shift-v and the desired movement (e.g. with j or G / shift-g )
image
  1. Now, press I / shift-i to insert at the beginning of the visual block, type anything and hit <escape>.

What you get is this:

image

Expected behavior

...instead of this:

image

Context

Config option `kernel_spec_manager_class` not recognized by `ListLabExtensionsApp`.
[W 2023-05-20 11:52:41.462 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
JupyterLab v3.5.0
/Users/matus/miniconda3/share/jupyter/labextensions
        jupyterlab-vimrc v0.5.2 enabled OK
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @axlair/jupyterlab_vim v0.14.5 enabled OK (python, jupyterlab_vim)
        @jupyter-widgets/jupyterlab-manager v5.0.7 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /Users/matus/miniconda3/share/jupyter/lab
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Web Browser Output
No browser console output
lukashergt commented 1 year ago
  1. Navigate to any line and select multiple lines with V / shift-v and the desired movement (e.g. with j or G / shift-g )

    1. Now, press I / shift-i to insert at the beginning of the visual block, type anything and hit <escape>.

This is not how column insert works in vim (neither in a terminal nor in jupyter). Instead:

  1. Navigate to any line and select multiple lines with ctrl-v and the desired movement (e.g. with j or G / shift-g and l or h)
  2. Now, press I / shift-i to insert at the beginning of the visual block or press A / shift-a to insert after the visual block, type anything and hit <escape>.
MatusGasparik commented 1 year ago

Thanks @lukashergt for your reply. I guess you are right. I just realized that it works for me in VSCode with the vim extension, but that has probably to do with the multi-line cursor functionality of the editor. I tried the same in vanilla VIM editor and indeed I need to use the column visual selection (ctrl-v) to make it work.

Another related question: is it in any way possible to use vim-commentary (https://github.com/tpope/vim-commentary) in the jupyterlab-vim extension?

MatusGasparik commented 1 year ago

Closing as this is a non-issue.