VSCodeVim / VSCodeVim/Vim

Remapping `Home`/`End` or `0`/`$` does not work in visual mode

Open
#4,425 4 comments 1 reaction 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

Describe the bug
Remapping Home/End or 0/$ does not work in visual mode in settings.json.

To Reproduce
Steps to reproduce the behavior:

  1. Add these in settings.json to "vim.visualModeKeyBindings":
            {
                "before": ["0"],
                "after": ["F"]
            },
            {
                "before": ["F"],
                "after": ["0"]
            },
            {
                "before": ["$"],
                "after": ["L"]
            },
            {
                "before": ["L"],
                "after": ["$"]
            },
  1. Ensure new settings take effect either though a save or a reset.
  2. Hit ESC to ensure you're in normal mode.
  3. Hit 'v' to ensure you're in visual mode.

Expected behavior

  • Hitting 'F' will move the visual mode highlight to the beginning of the line
  • Hitting 'L' will move the visual mode highlight to the beginning of the line

Actual behavior

  • Hitting 'F' will do nothing
  • Hitting 'L' will move the cursor and the visual highlight to the bottom of the page
  • Hitting either key will intermittently make the editor unresponsive to keyboard input

Screenshots
N/A

Environment (please complete the following information):

  • Reproduced on macOS
  • Reproduced on Ubuntu 18.04
  • Extension (VsCodeVim) version: 1.41.1
  • VSCode version: 1.12.4
  • OS: mac OS Mojave 10.14.6

From Code > About on macOS:

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:57:51.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.7.0

Additional context
Remapping 0 to F an $ L works correctly in normal mode. This is only an issue with visual mode.

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 using the settings.json entries under vim.visualModeKeyBindings, then compare the behavior in normal and visual modes. Trace the visual-mode keybinding handling and verify that remapped 0/$ or Home/End keys move the selection as expected without making keyboard input unresponsive.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.