将 VS Code 光标保持在屏幕上

Mat*_*t W 3 visual-studio-code

当使用 Ctrl + 向上/向下滚动 VS Code 时,如何使文本光标(插入符号)保持在屏幕上?

我搜索了滚动选项、文本选项、扩展名等,但无济于事。

Bra*_*son 7

这就是我正在使用的keybindings.json,它与 Visual Studio 的 Ctrl+Up/Down 行为非常匹配。(即:基本上是 SebastianDB 的答案,但对于按键和向上/向下排列而不是页面。此外,您不需要宏扩展,它开箱即用)。

    {
        "key": "ctrl+up",
        "command": "editorScroll",
        "args": {
            "to": "up",
            "by": "line",
            "revealCursor": true
        },
        "when": "editorTextFocus"
    },
    {
        "key": "ctrl+down",
        "command": "editorScroll",
        "args": {
            "to": "down",
            "by": "line",
            "revealCursor": true
        },
        "when": "editorTextFocus"
    }    
Run Code Online (Sandbox Code Playgroud)