Issue with cursor position using visual line movement (`gj` and `gk`)
Nobody has claimed this yet.
- 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):

What happened instead?
Current behaviour (the keybinding mappings applied):

Technical details:
- VSCode Version: 1.9.1
- VsCodeVim Version: 0.5.3
- OS: MacOS 10.12.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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