簡體   English   中英

將 VS Code 光標保持在屏幕上

[英]Keep VS Code cursor on screen

在 VS Code 中使用 Ctrl + 向上/向下滾動時,如何將文本光標(插入符號)保持在屏幕上?

我搜索了滾動選項、文本選項、擴展名等,但無濟於事。

這是我在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"
    }    

我自己沒有試過這個,但你看過這個了嗎?

安裝這個:

https://marketplace.visualstudio.com/items?itemName=geddski.macros

然后使用此示例將宏添加到 ctrl+up/down 並將鍵從 alt+pageup 更改為您想要的。

https://github.com/Microsoft/vscode/issues/22796

{
    "key": "alt+pageup",
    "command": "editorScroll",
    "args": {
        "to": "up",
        "by": "page",
        "revealCursor": true
    },
    "when": "editorTextFocus"
}

希望它有效,祝你好運!

也許您正在尋找類似 vim 中的scrolloff類的東西? 然后將其添加到settings.json

    "editor.cursorSurroundingLines": 9999,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM