VSCodeVim / VSCodeVim/Vim

Issue with cursor position using visual line movement (`gj` and `gk`)

Open
#1,323 19 comments 76 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

I've set the following as I like to work with word wrap enabled:

    "vim.otherModesKeyBindingsNonRecursive": [
        {
            "before": ["j"],
            "after": ["g", "j"]
        },
        {
            "before": ["k"],
            "after": ["g", "k"]
        }
    ]

I noticed a discrepancy in behaviour for lines without wrapping. As you navigate between lines of varying length the cursor position doesn't keep its horizontal position.

The following GIFs just show motion using j and k.

I would expect both GIFs to show the same thing regardless if the gj and gk mappings are applied.

What did you expect to happen?

Expected behaviour (the keybinding mappings not applied):
normal vim movement

What happened instead?

Current behaviour (the keybinding mappings applied):
normal vim movement

Technical details:
  • VSCode Version: 1.9.1
  • VsCodeVim Version: 0.5.3
  • OS: MacOS 10.12.3

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 the issue in VSCode Vim with word wrap enabled and the listed non-recursive j/k mappings, comparing them with direct gj/gk movement. Trace the cursor-motion handling and inspect the existing behavior around visual line movement. Done means mapped j and k preserve horizontal cursor position like direct gj and gk across lines of different lengths.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.