Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive window and VIM mode #11657

Open
1 of 2 tasks
Paul-Aime opened this issue Oct 14, 2022 · 8 comments
Open
1 of 2 tasks

Interactive window and VIM mode #11657

Paul-Aime opened this issue Oct 14, 2022 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window

Comments

@Paul-Aime
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

I use VIM mode and the Jupyter Interactive Window, but there are some conflicts in the text area of the interactive window:

  • The <UP> arrow does not work to get the previous cells content.

    • Neither does k when in VIM normal mode, as would also be expected.
  • The <ESC> key, used to go in VIM normal mode, clears the input area.

    • This is the same behavior than without VIM, although even there I would prefer that it does not clears the input area
    • It is annoying to lost my input by inadvertently pressing <ESC>, which occurs often when using VIM.
    • The VIM modes are available in that input area: <Ctrl-C> (or other custom mapping) still works to go in VIM normal mode.

VS Code Version

Version: 1.72.1 Commit: 129500ee4c8ab7263461ffe327268ba56b9f210d Date: 2022-10-10T17:23:00.760Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 5.14.0-1052-oem Sandboxed: No

Jupyter Extension Version

v2022.9.1202862440

Jupyter logs

No response

Coding Language and Runtime Version

Python v3.10.6

Language Extension Version (if applicable)

Python v2022.16.1

Anaconda Version (if applicable)

conda 22.9.0

Running Jupyter locally or remotely?

Local

@Paul-Aime Paul-Aime added the bug Issue identified by VS Code Team member as probable bug label Oct 14, 2022
@amunger
Copy link
Contributor

amunger commented Oct 14, 2022

you can re-bind the keyboard shortcut for interactive.input.clear to avoid having escape clear the input box.

as for previous/next cell commands while in "normal" VIM mode, it looks like were not handling that correctly, I'll have to take a look.

@amunger amunger added the interactive-window Impacts interactive window label Oct 14, 2022
@Paul-Aime
Copy link
Author

@amunger thanks for the shortcut command.

For the previous/next cell command, it should work with k in "normal" VIM mode, but also with <UP> in "insert" VIM mode maybe

@Paul-Aime
Copy link
Author

For the interactive.history.next/previous commands, the issue seems related with the when expression regarding interactiveInputCursorAtBoundary:

The default when expression for interactive.history.previous is:

!suggestWidgetVisible && resourceScheme == 'vscode-interactive' && interactiveInputCursorAtBoundary != 'bottom' && interactiveInputCursorAtBoundary != 'none'

Turning it into the following works for me, as I use j/k to move up/down between lines, and now <UP>/<DOWN> moves between cells:

!suggestWidgetVisible && resourceScheme == 'vscode-interactive'

@amunger
Copy link
Contributor

amunger commented Oct 19, 2022

that makes sense, thanks for the investigation and update. It doesn't really make sense to have boundary conditions when moving between cells have their own dedicated commands, maybe there's a smarter way to implement that

@Lolcroc
Copy link

Lolcroc commented Nov 21, 2022

Relative line numbering in the input cell also looks broken. I'm getting the same result as in VSCodeVim/Vim#7130 (comment).

@duke8585
Copy link

duke8585 commented Feb 9, 2023

it would be great if one were able to define a custom shortcut for leaving the jupyter edit mode and thus entering the command mode. i see this is not possible atm. could not see an issue explicitly addressing it, should i open one?

@amunger
Copy link
Contributor

amunger commented Feb 9, 2023

@duke8585 - it sounds like you're looking for notebook.cell.quitEdit, which is escape by default

@duke8585
Copy link

duke8585 commented Mar 3, 2023

thanks @amunger, set it to "CTRL+M" double tap and it works like a charm :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window
Projects
None yet
Development

No branches or pull requests

4 participants