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

Replacing a character with j or k in a jupyter notebook can move between cells #9474

Closed
apuranik1 opened this issue Feb 4, 2025 · 1 comment

Comments

@apuranik1
Copy link

Describe the bug
When trying to replace a character in the first line of a jupyter cell with k, or a character in the last line with j, focus shifts to another cell.

To Reproduce

  1. Make a jupyter notebook.
  2. Make three cells and one line of text in the middle cell.
  3. Put the cursor on any character in that line and type rj in normal mode. Your cursor ends up in the next cell.
  4. Move back up to the previous cell with k, then press any character except j or k. The first character of the line gets replaced with that character.

Expected behavior
The character should have been replaced with j in step 3.

Screenshots

Notebook setup
Image

After rj

Image

After kx

Image

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.29.0
  • VSCode version: 1.96.4
  • OS: Windows 11

Additional context
Add any other context about the problem here.

@apuranik1
Copy link
Author

I now believe this is an issue with the Jupyter Keymap extension. I fixed the problem with the following new entries in keybindings.json:

	{
		"key": "j",
		"command": "-notebook.focusNextEditor",
		"when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'none' && notebookEditorCursorAtBoundary != 'top'"
	},
	{
		"key": "k",
		"command": "-notebook.focusPreviousEditor",
		"when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'"
	},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant