将 VS Code 光标保持在屏幕上
Keep VS Code cursor on screen
在 VS Code 中使用 Ctrl + up/down 滚动时,如何使文本光标(插入符号)保持在屏幕上?
我搜索了滚动选项、文本选项、扩展名等,但都没有找到。
我自己还没有尝试过,但是你看过了吗?
安装这个:
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,
这就是我在 keybindings.json
中使用的,它与 Visual Studio 的 Ctrl+Up/Down 行为非常匹配。 (即:基本上是 SebastianDB 的答案,但对于键和行 up/down 而不是页面。此外,您不需要宏扩展,它开箱即用)。
{
"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"
}
在 VS Code 中使用 Ctrl + up/down 滚动时,如何使文本光标(插入符号)保持在屏幕上?
我搜索了滚动选项、文本选项、扩展名等,但都没有找到。
我自己还没有尝试过,但是你看过了吗?
安装这个:
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,
这就是我在 keybindings.json
中使用的,它与 Visual Studio 的 Ctrl+Up/Down 行为非常匹配。 (即:基本上是 SebastianDB 的答案,但对于键和行 up/down 而不是页面。此外,您不需要宏扩展,它开箱即用)。
{
"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"
}