You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VS Code中指定scrollLineDown和scrollLineUp的滚动行数?

修改VS Code中scrollLineDown/scrollLineUp的滚动行数

VS Code原生没有直接配置滚动行数的选项,但可以通过自定义快捷键实现多行滚动效果,步骤如下:

  • 打开快捷键设置界面:按下Ctrl+K Ctrl+S(Windows/Linux)或Cmd+K Cmd+S(Mac),也可通过菜单栏「文件>首选项>键盘快捷方式」打开。
  • 点击快捷键界面右上角的{}图标,打开keybindings.json文件。
  • 在keybindings.json中添加以下配置,将默认上下滚动快捷键替换为执行多次滚动命令的组合,示例设置为每次滚动3行:
[
    {
        "key": "down",
        "command": "runCommands",
        "args": {
            "commands": [
                "scrollLineDown",
                "scrollLineDown",
                "scrollLineDown"
            ]
        },
        "when": "textInputFocus && !editorReadonly"
    },
    {
        "key": "up",
        "command": "runCommands",
        "args": {
            "commands": [
                "scrollLineUp",
                "scrollLineUp",
                "scrollLineUp"
            ]
        },
        "when": "textInputFocus && !editorReadonly"
    }
]
  • 保存文件后,按下上下箭头即可每次滚动指定行数,可根据需求调整commands数组内的命令数量。

注意:若之前已有上下箭头的快捷键配置,需先删除或注释对应条目,避免冲突。

如果你使用VSCodeVim插件,可直接在settings.json中添加配置:

"vim.scrollLineDown": 3,
"vim.scrollLineUp": 3

以此直接设置Vim模式下的滚动行数。

内容的提问来源于stack exchange,提问作者toni057

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 03:09:52