VSCodeVim / VSCodeVim/Vim

`:normal` incorrectly executes motion commands

Open
#8,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/neovim kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
The :normal command is incorrectly executing motion commands (i.e. h, l, j, k). It moves the cursor to the correct place, but only for a fraction of a second, after which the cursor returns to its former location.

To Reproduce
Steps to reproduce the behavior:

  1. Open any file with the Vim extension enabled
  2. Enter the command :normal G (or any other motion command)
  3. See incorrect behavior

Expected behavior
Executing commands such as these should move the cursor to the correct position and leave it there. For instance, :normal G should move the cursor to the beginning of the last line in the file, or :normal 3j should move the cursor 3 lines down. This behavior is seen in the command-line NeoVim.

Screenshots
A GIF of the failure of the :normal G command as was earlier described.
:normal G failing

A GIF of the failure of the :normal j command, showing the same behavior as the :normal G command
:normal j failing

A GIF of the command :normal jdd being run. It successfully deletes the line, but the cursor returns to its original position as with the previous two GIFs. This behavior is also incorrect.
:normal jdd kind of working

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.24.2
  • VSCode version: 1.73.0
  • OS: Windows 11

Additional context
It can be seen that it does execute the command; only the cursor movement fails. In the third GIF I show that :normal jdd properly deletes the line 1 below the cursor, but it once again returns the cursor to its starting position.

It should be noted that I have NeoVim enabled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing :normal G, :normal j, and :normal jdd in the VSCode Vim extension, then compare their cursor behavior with command-line NeoVim. Trace the :normal command and motion-command handling to find why cursor movement is reverted; done means motions leave the cursor at the expected position while compound commands still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
neovim, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.