Search code examples
visual-studio-code

Microsoft VS Code - Jump 10 lines vertically at once


Im playing around with the idea of using Microsoft VS code as a text editor. Currently I am a sublime user and I have it configured to be able to jump 10 lines vertically (up or down) when I use the key combinations OPT key + Up or down. I would like this same functionality on VS Code but cannot find a way to duplicate it there. Can someone please outline how I can go about solving this. Thanks.

Additional information: Operating System: OSX 10.13 (High Sierra)


Solution

  • Put this into keybindings.json

    {
        "key": "ctrl+up",
        "command": "cursorMove",
        "args": {
            "to": "up",
            "by": "line",
            "value": 10
        },
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+down",
        "command": "cursorMove",
        "args": {
            "to": "down",
            "by": "line",
            "value": 10
        },
        "when": "editorTextFocus"
    },
    

    cursorMove - Move cursor to a logical position in the view

    args:

    to: A mandatory logical position value providing where to move the cursor.

    'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
    'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
    'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
    'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
    

    by: Unit to move. Default is computed based on 'to' value.

    'line', 'wrappedLine', 'character', 'halfLine'
    

    value: Number of units to move. Default is '1'

    select: If 'true' makes the selection. Default is 'false'.

    https://code.visualstudio.com/api/references/commands