VSCodeVim / VSCodeVim/Vim

Relative line number jumps don't work

Open
#6,550 4 comments 2 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.

Commands like number + j or number + k take you to the wrong line number.

Steps to reproduce

  1. Open any file > 20 lines of code
  2. In Normal mode type 14j or 14k (use any number greater than 12)
  3. Notice how the cursor jumps more than 14 lines

Please let me know if you need more steps to reproduce

Screen Shot 2021-04-25 at 2 04 37 PM

Cursor on absolute line 43

Screen Shot 2021-04-25 at 2 04 54 PM

Command ran 14k

Technical details:

VSCode Version: 1.55.2
VsCodeVim Version: 1.20.0
OS: MacOS 11.2.3

settings.json

{
    "editor.cursorBlinking": "phase",
    "editor.tabSize": 2,
    "editor.roundedSelection": true,
    "editor.glyphMargin": true,
    "editor.fontSize": 12,
    "editor.rulers": [
        100
    ],
    "editor.renderIndentGuides": true,
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.scrollBeyondLastLine": false,
    "editor.minimap.enabled": false,
    "editor.wordWrap": "wordWrapColumn",
    "files.exclude": {
        //"**/.tmp": true,
        "bazel-*": true,
        "pkg*": true,
        ".venv": true,
        "**/vendor": true,
        "**/.git": true,
        "**/.DS_Store": true,
        "go-build/.go": true,
        ".vscode": true,
        "env": true,
        "env_docs": true,
        "udeploy": true,
        "debian": true,
        "**/*.test": true,
        "**/*.pyc": true,
        "Godeps/_workspace": true,
        "**/coverage.html": true,
        "**/_build": true,
        "**/*.coverprofile": true,
        "**/__pycache__": true
    },
    "go.inferGopath": false,
    "go.gopath": "/${env:HOME}/gocode",
    "go.goroot": "/usr/local/go",
    "go.toolsGopath": "/usr/local/go/pkg/tool/darwin_amd64",
    "go.toolsEnvVars": {
        "GO111MODULE": "off",
    },
    "go.useLanguageServer": true,
    "files.watcherExclude": {
        "bazel-*": true,
        "pkg*": true,
    },
    "eslint.alwaysShowStatus": true,
    "eslint.format.enable": true,
    "editor.largeFileOptimizations": false,
    "files.trimTrailingWhitespace": true,
    "files.autoSave": "onFocusChange",
    "files.insertFinalNewline": true,
    "go.autocompleteUnimportedPackages": true,
    "go.lintTool": "golint",
    "go.lintFlags": [
        "--fast",
        "--enable=errcheck"
    ],
    "go.vetFlags": [
        "-printfuncs=wrapf,statusf,warnf,infof,debugf,noerrorf,equalf,newexiterrorf,containsf,truef,falsef,equalf,emptyf,failf"
    ],
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": true,
    "python.linting.pylintEnabled": false,
    "python.linting.lintOnSave": true,
    "[python]": {
        "editor.tabSize": 4
    },
    "window.titleBarStyle": "custom",
    //"python.formatting.provider": "yapf",
    "vim.useCtrlKeys": true,
    "vim.enableNeovim": true,
    "vim.insertModeKeyBindings": [
        {
            "before": [
                "k",
                "j"
            ],
            "after": [
                "<Esc>"
            ]
        }
    ],
   "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": [
                "j"
            ],
            "commands": [
                {
                    "command": "accelerated.cursorDown"
                }
            ]
        },
        {
            "before": [
                "k"
            ],
            "commands": [
                {
                    "command": "accelerated.cursorUp"
                }
            ]
        },
        {
            "before": [
                "n"
            ],
            "after": [
                "k"
            ]
        },
        {
            "before": [
                "t"
            ],
            "after": [
                "j"
            ]
        },
        {
            "before": [
                "s"
            ],
            "after": [
                "l"
            ]
        },
        {
            "before": [
                ",",
                "w"
            ],
            "after": [
                ":",
                "w"
            ]
        }
    ],
    "accelerated.accelerationTable": [
        12,
        17,
        21,
        24,
        26,
        28,
        30
    ],
    "[cpp]": {
        "editor.quickSuggestions": false
    },
    "[c]": {
        "editor.quickSuggestions": false
    },
    // https://github.com/Microsoft/vscode/issues/23991
    "keyboard.dispatch": "keyCode",
    "editor.fontFamily": "'Ubuntu Mono', 'monospace', monospace, 'Droid Sans Fallback'",
    "workbench.activityBar.visible": false,
    "materialTheme.autoApplyIcons": true,
    "telemetry.enableTelemetry": false,
    "editor.wordWrapColumn": 100,
    "breadcrumbs.enabled": true,
    "go.formatTool": "goimports",
    "launch": {
        "configurations": [],
        "compounds": []
    },
    "go.delveConfig": {
        "dlvLoadConfig": {
            "followPointers": true,
            "maxVariableRecurse": 1,
            "maxStringLen": 64,
            "maxArrayValues": 64,
            "maxStructFields": -1
        },
        "apiVersion": 2,
        "showGlobalVariables": false
    },
    "notebook.kernelProviderAssociations": [],
    "go.alternateTools": {},
    "json.schemas": [],
    "[javascript]": {
        "editor.defaultFormatter": "dbaeumer.vscode-eslint"
    },
    "javascript.updateImportsOnFileMove.enabled": "always",
    "gitlens.currentLine.dateFormat": "",
    "editor.fontLigatures": false,
    "[javascriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.lineNumbers": "relative",
}

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 14j and 14k in a file longer than 20 lines, using the reported VSCodeVim settings, especially the accelerated cursor mappings and relative line numbers. Compare the resulting cursor position with the requested count and verify the behavior without those custom mappings. Done means counted jumps land on the expected line without breaking the reported configuration.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.