VSCodeVim / VSCodeVim/Vim

`L` and `H` commands should move cursor *without* scrolling the editor view

Open
#10,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
The L and H commands should only move the cursor, as they do in vim. Currently they both move the cursor and scroll the viewport to make a few lines of context around the cursor visible. Likewise, j should never scroll the viewport up, and k should never scroll it down, which they currently do if the cursor is manually positioned near the top or bottom of the viewport (for example, using the mouse).

LMH are commands for moving the cursor within the current viewport, so it seems logical to me for them to keep the viewport fixed, and to be idempotent, as they are in vim, even though VS Code likes to keep a few lines of context visible when moving the cursor with the arrow keys (but not when moving it with the mouse).

To Reproduce
Steps to reproduce the behavior:

  1. Open a file with lots of lines.
  2. 500GLk

Expected behavior
Viewport scrolls to have line 500 in the middle. Cursor moves to the bottom visible line without any viewport motion. Cursor moves up one line without any viewport motion.

(From this state, I think I would expect j to scroll the viewport to make a few lines of context visible, since that's how VS Code normally behaves.)

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

Reproduce 500GLk in a long file, then trace the command handlers for L, H, j, and k. Compare cursor movement with viewport position in the described edge cases; done means L and H leave the viewport fixed, while j and k do not scroll in the prohibited directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.